Questions tagged [matplotlib]

Matplotlib is a plotting library for Python, built on NumPy and often used interactively with IPython. Its compact "pyplot" interface is similar to the plotting functions of MATLAB®.

Filter by
Sorted by
Tagged with
4 votes
2 answers
229 views

Optimizing Multiple Subplot Visualization and Navigation in Matplotlib

I have implemented a class in Python using Matplotlib for visualizing multiple subplots along with navigation buttons to move between different subsets of data. Each subplot displays a contour plot ...
Cold Fire's user avatar
1 vote
1 answer
50 views

pyqt6 UI for displaying streaming data to two plots and an image display

So I have a large application that I've been writing. One part of that application is responsible for displaying images taken from a camera and plotting two graphs. I've successfully stripped out the ...
Michael's user avatar
  • 303
1 vote
1 answer
59 views

Extending die roll simulations for complex data science tasks

I've developed a Python script that simulates die rolls and analyses the results. I'm now looking to extend and modify this code for more complex data science tasks and simulations. Is this code ...
Attila Vajda's user avatar
0 votes
1 answer
33 views

Change the appearance of a log graph with two x axes

I would like to improve the overall look and feel of the two log graphs generated by the Python code below. The first graph represents the optimized methods while the second graph represents the ...
Ruan's user avatar
  • 101
3 votes
1 answer
66 views

Simulate evolution of a group of cells

The following code simulates the (simplified) concept of evolution of cells. They can reproduce, grow older and have a fitness which modifies their chance of survival. Using matplotlib, graphs are ...
Dornteufel's user avatar
5 votes
2 answers
375 views

groupby in pandas and plot

I have a csv file that looks like this: ...
Fang's user avatar
  • 535
1 vote
1 answer
189 views

Plotting correlation matrix with Seaborn and pandas

I try to plot the correlation matrix of a Pandas DataFrame. As the diagonal elements are always ones, and the matrix is symmetrical, so I can get rid of most than a half of the squares without loosing ...
Arpad Horvath's user avatar
0 votes
1 answer
120 views

Plot the frequency of occurrence, using shortest string as bounds

Preface: Before anyone suggest using pandas, no I don't want to use pandas, only pure python please. The concept of my code is quite simple, given some list of strings in a text file formatted as such ...
samman's user avatar
  • 471
1 vote
1 answer
42 views

Plotting determinant probabilities

This is a fun exercise that tries to answer the following question: if the elements from a square matrix are randomly chosen from 0 to 9, is it more like that the determinant would be even or odd? I'm ...
Maxwell's Daemon's user avatar
1 vote
1 answer
93 views

Create charts after querying database

I'm at the end of the IBM Data Analyst course, and I wanted to ask for a rating of a piece of code I wrote as a solution to its exercises from the final chapter. I know I could write it on the forum ...
kkkkrkrkkk's user avatar
1 vote
1 answer
86 views

Plot time windows based on interested value

I use the following code to identify some interested values into a dataframe and them plot a time window before and after that value appeared. It works very well, but I would like to know if there is ...
GregOliveira's user avatar
3 votes
0 answers
82 views

Decorator implementation around xarray.open_dataset

If you would like to download some grib data for yourself, the script below will pull girb data from the google api over a date range at an hourly interval. Extract some hrrr grib2 data ...
Jason Leaver's user avatar
1 vote
0 answers
685 views

Python fractal tree generators

I wrote the scripts several days ago, they do exactly what I intended, but the performance is not very good, I am still stuck on for loops and don't know how to vectorize things, I wrote both scripts ...
Ξένη Γήινος's user avatar
3 votes
1 answer
1k views

Colored bar plots with confidence intervals

I needed to create a bar plot that show: the mean from some series; them 95% confidence interval; and, bars might be colored blue if they are definitely above this value (given the confidence ...
GregOliveira's user avatar
5 votes
0 answers
125 views

A Python script that creates n-flakes

I have written a simple Python script that generates n-flakes using matplotlib. Wikipedia article on N-flake. I wrote two functions, one function generates pentaflake, the other generates hexaflake, I ...
Ξένη Γήινος's user avatar
1 vote
0 answers
273 views

A collection of Python functions that fill a given region with rectangles

These are what I was working on in the last few days, I wrote a bunch of functions that fill a given region with rectangles of different colors. The functions can: Randomly split a region into sub ...
Ξένη Γήινος's user avatar
5 votes
1 answer
313 views

Compute and plot a 2D vector field with radial symmetry in Python

I computed a 2D vector field \$\mathbf{U} = (u(x,y), v(x,y))\$ with radial symmetry, parametrized as \$(u,v) = a(r) (x,y) + b(r) (-y,x)\$, where \$a(r), b(r)\$ are given as solution of an IVP which I ...
Max's user avatar
  • 171
5 votes
0 answers
172 views

A Python 3 script that generates art using matplotlib

I am always super interested in both science and art, science and art are two different ways to describe the objective reality, they are two sides of the same coin, in many areas they overlap, and ...
Ξένη Γήινος's user avatar
1 vote
1 answer
104 views

Trouble with rendering speed of the animation of a simulation?

The following code is a conversion from some old java I wrote to python. It shows the beginnings of a simulation of an ant colony. I am finding the animation speed very slow - and I'm wondering if I ...
Konchog's user avatar
  • 187
2 votes
0 answers
82 views

Interactive Gundam using only Matplotlib

The code below plots a background image (sky) and then a Gundam sprite using Matplotlib. It also creates 4 buttons with obvious purposes. The Gundam class stores 2 ...
Redsbefall's user avatar
  • 1,132
2 votes
1 answer
2k views

Auto-fitting text into boxes in matplotlib

Task I tried to code a treemap function in matplotlib, and one of the challenges is auto-fitting text into boxes of different sizes in the treemap, similar to R's package ggfittext. My Code My ...
Z-Y.L's user avatar
  • 163
4 votes
1 answer
147 views

Modeling global warming with a sinusoidal fit in Python

I would like to model global warming from temperature records recorded daily from June 1920 to October 2019 in Montélimar on Python. To do this, I would first like to model these seasonal variations ...
Donny's user avatar
  • 41
6 votes
1 answer
370 views

Calculating quantiles of timeseries data and then create a "fanplot"

My code is working properly, but I am looking for better approach in the calculation of quantiles and the finding of the data in the dataframe. ...
cebep27's user avatar
  • 63
3 votes
1 answer
221 views

Collatz conjecture with plots

I have an assignment where I write a Collatz Conjecture program for a series of starting values from 1 to N and make two plots: number of iterations vs starting value and computed numbers vs starting ...
Dila's user avatar
  • 215
4 votes
1 answer
382 views

Path of a particle in a non-uniform B field

I have completed my project which simulates the path of a particle trapped in a device known as a magnetic mirror. I would like your thoughts and improvements on my implementation. Here is the code: <...
Dila's user avatar
  • 215
4 votes
0 answers
3k views

Student report card management Python program

The program is designed to take data from a MySQL database, using mysql-connector-python, and print it as a table in Python using the texttable module. The program also plots charts based on the data ...
Random Person's user avatar
2 votes
1 answer
62 views

RadioButtons with round circles

I was struggling to make the RadioButtons widget look presentable. Either the circles were not round, or the frame had a totally wrong shape, or both (see pictures below, and also this question on SO)....
Yulia V's user avatar
  • 635
2 votes
1 answer
700 views

Implementing histogram in python

I was trying to implement my own version of matplotlib's hist function and I came up with this: ...
Amirhossein Rezaei's user avatar
1 vote
1 answer
99 views

Plot a simple scatter plot graph with two additional solid lines

I have been coding in Python for a number of years now. I've always felt that Matplotlib code takes up a lot more lines of code than it should. I could be wrong. I have the following function that ...
Ruan's user avatar
  • 101
7 votes
1 answer
145 views

GUI that reads data and generates/ saves charts

I have a program that uses pandas to read csv files and then generates and saves graphical charts. I have been trying to follow the SOLID principles so I have tried to seperate responsibilities. So ...
JudasMoses's user avatar
4 votes
0 answers
208 views

Animating Lissajous curves with Python and matplotlib's animation library

I'd like to plot an animation of Lissajous curves using Python and matplotlib's animate library. I really do not have a lot of experience with Python, so rather ...
pmpyt's user avatar
  • 41
3 votes
1 answer
120 views

3d Cistercian numbers mini game (MatPlotLib), inputting similar xyz coordinates 50 times, how to streamline?

Dear coding black belts, My code is working but seems clunky. Take a random number from 1 to 99,999 Display it in 3D in a modified version of the Cistercian numerals from 13th century monks (adding ...
Jelaludo's user avatar
1 vote
1 answer
45 views

Removing Loop from Numpy XOR

I have been playing around with numpy and matplotlib. My little project was to create a scatter plot ranging from -1 to 1 on both X and Y, but where the shading is done with the XOR scheme. The ...
GalacticPonderer's user avatar
4 votes
0 answers
554 views

Modified Gantt Chart

this is my very first pandas/matplotlib code and I would be grateful if you can review my code and share your thoughts or ideas for improvement. Please focus on code, not the features of resulting ...
Jaroslav Hradský's user avatar
3 votes
1 answer
117 views

Manipulating Pandas Dataframe with vaccination data from CSV to display on matplotlib

I have some code that manipulates a Pandas Dataframe containing Covid-19 vaccine data and displays it on Matplotlib. The data is here: https://covid.ourworldindata.org/data/owid-covid-data.csv (...
KetZoomer's user avatar
2 votes
0 answers
1k views

Slow render of a graph path using python matplotlib animation

I am computing shortest paths of graphs using Python Networkx and Matplotlib. I'm focused on animating the route inspection problem path in particular here. My goal is to smoothly render such ...
Richard's user avatar
  • 57
0 votes
1 answer
344 views

scatter subplot for iris dataset

I'm new to data science. I wrote this script for plotting all different kinds of iris data set scatter plot. trying not to plot something with itself . how can I optimize my code ? ...
vhd's user avatar
  • 3
2 votes
2 answers
106 views

Downloading COVID data and uploading graphs

So this is a project I have been working on for the last few weeks. Just started learning Python. Started out with bash scripting and got the itch to learn more. Anyway code fetches covid-19 data from ...
drebrb's user avatar
  • 137
2 votes
1 answer
52 views

Hardware driven data processing and ploting in need of better control flow

This is code for a measurement setup that receives a steady stream of UDP data, finds the trigger in one channel and operates on the data in the other channel to enhance the signal and remove noise, ...
Andreas Schuldei's user avatar
1 vote
0 answers
33 views

Spectrograph using array-of-slice-references

I've written a working and complete proof of concept that shows a spectrograph in Matplotlib. I want to nail down this proof of concept before I continue with development, and I'm not thrilled with ...
Reinderien's user avatar
1 vote
1 answer
107 views

TicTacToe: If an error messages do not appear straight away

I am fairly new to Python and have tried to create a tic tac toe game that is completely automatic, where you can see if a player1 has an advantage if you let it ...
Ida's user avatar
  • 11
1 vote
1 answer
63 views

Covid-19 World Case Report Beta 0.1

I am a self-learned programmer and this is my first program. I would really appreciate any critique on my approach. The program should automatically download the who data file to the folder these ...
AgentJRock's user avatar
0 votes
1 answer
170 views

What do you think about my version of matplotlib subplots of filled contours with a "synchronized" color scheme?

Dear Python VIS community. Imagine the following situation: You ran an experiment in an earth system model (ESM) where you altered some input parameters relative to a control run of the same ESM. Now ...
oddquestionoddanswer's user avatar
0 votes
1 answer
4k views

Plotting with interpolation using Matplotlib

Program description: You are given a set of two functions: $$f=x^3-6x^2+x+5; g=(x-2)^2-6$$ Plot them using Matprolib on a user input segment [a; b]. My solution: ...
JoshJohnson's user avatar
4 votes
0 answers
97 views

2048 in Matplotlib

I did an OOP to make 2048 using Matplotlib visualization. The color dictionary is for setting different colors to each number in the game. There are two classes ...
Redsbefall's user avatar
  • 1,132
0 votes
1 answer
67 views

Matplot lib : scalling of the axes on bar plot [closed]

I am using following script to plot cluster populations using two lists contained x and y data ...
Maître Renard's user avatar
4 votes
1 answer
573 views

A graphing calculator

I wrote a calculator that can solve equations with variables using matplotlib and sympy. I am looking for tips on performance and style. How can I improve on this calculator? Is it a good idea to use ...
JSScratchDouble's user avatar
2 votes
0 answers
24 views

Getting Graph and Block Animation to Run Smoothly Together

I have been working on some code that produces a live graphic of a graph and blocks moving. It works in theory but does not look like how I want. The animation runs very slow when showing both the ...
jared's user avatar
  • 121
3 votes
1 answer
477 views

matplotlib fixing axis scale and alignment

There is few points In the script I don't like I think it can be improved, but I need a second opinion, here is the interactive plot I'm trying to build. here is the code with thought in comments. <...
rho's user avatar
  • 131
5 votes
1 answer
277 views

Jupyter notebook style help + code suggestions for pandas

I wanted to open source some code to scrape and analyze publicly-filed stock buys and sells from U.S. senators. I'm not familiar with code style for Jupyter notebooks or pandas in general. Would it be ...
Neel's user avatar
  • 101