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®.
179 questions
18
votes
1
answer
7k
views
Plot timings for a range of inputs
When writing Code Review answers, it becomes often necessary to measure how long the modified code takes vs how long the OP's code takes. I needed a nice way to visualize this as a function of the ...
15
votes
3
answers
5k
views
Orbital Trajectory simulator
I have written a simple program to do trajectory simulation in the Earth-Moon system, it still has a long way to go I am working on making it more class oriented and am looking into implementing a ...
15
votes
1
answer
1k
views
Racetrack plotter
My Racetrack is just that. A Racetrack. You can't race it (yet) because I had trouble with collision detection, but I wanted to share it anyway.
It creates a base polygon by using ...
15
votes
1
answer
6k
views
Time-scrolling interface in matplotlib
I've create a simple interface for viewing a time-series as it changes over time in matplotlib. You can pause, reset or click/drag on the time-line to change the view. Have I used the matplotlib API ...
14
votes
2
answers
3k
views
Python Sound visualizer
The past week I have tinkered making a sound visualizer using Tkinter, Matplotlib, NumPy, PyAudio and using a thread to be able to play the sound and to display the plot at the same time.
I have been ...
14
votes
1
answer
12k
views
Farthest point algorithm in Python
I am learning Python and I tried to do a program to find K points from a set of N points, farthest as much as possible (I'm not ...
13
votes
2
answers
1k
views
Numerics for a game theory calculation using expected utility
I am trying to replicate Bruce B. de Mesquita's (BDM) results on political game theory for prediction. Based on where actors stand on issues, their capabilities, salience, BDM's method attempts to ...
13
votes
1
answer
1k
views
A big "Game of Life"
Our quest: Create a big simulation for Conway's Game of Life, and record the entire simulation history.
Current Approach: Cython is used for an iterate method. The ...
13
votes
1
answer
1k
views
Plotting polynomials roots
NOTE: See follow up to this question here
I created a simple python script to plot quadratic, cubic and quartic polynomials with integer coefficients between -4 and 4. It uses numpy to find the roots ...
12
votes
3
answers
642
views
Plotting different parameterized polynoms
For a university assignment I had to plot different polynomial functions depending on one single parameter. That parameter gave the number of supporting points to interpolate a given function in the ...
12
votes
1
answer
12k
views
Time and temperature displaying program for Raspberry Pi
This program displays either the time, current temperature, 12hr graph of temps, 24 hr graph of temp or a week's graph of temps. Selection is based on user input of one of the GPIO pins.
Please ...
12
votes
1
answer
9k
views
Plotting a rectangular prism
I'm creating a rectangular prism function, whose output looks like this:
I think that this code can be improved by optimizing the use of np.meshgrid with a Python ...
12
votes
1
answer
5k
views
Predator-prey simulation
I made a random-walk predator-prey simulation that focuses on individual animals instead of the (maybe) more common array-based approach. I'd like to hear your opinion about this: how could the ...
12
votes
1
answer
889
views
Live-streaming tweets and plot its sentimental value in colors on a world map
I want to have someone reviewing and helping me get some good ideas in how to improve my current project.
All information about the project is in the following github link.
I would also appreciate ...
11
votes
1
answer
3k
views
Modified Taylor diagrams
There is a type of diagram summarizing how well predictions from numerical models fit expectations; one obvious use case is comparing machine-learning regression models. Modified Taylor diagrams are ...
10
votes
2
answers
4k
views
Predator Prey Simulation
Below is a simple random walk predator prey simulation that is optimized to the best of my abilities. I would love to hear about any improvements that can made.
...
10
votes
1
answer
340
views
Visualize Parts of Song as Analyzed by Echonest
This is the a bit of code that works with Echonest API's pyechonest and remix libraries combined with matplotlib.pyplot to offer a simple visual representation of the start and end "parts" of a music ...
10
votes
1
answer
122
views
Measure size of repository as a function of time
In order to avoid having to make any real progress (at least for a short time), I wrote a script that measures how much progress I have made so far, instead. Specifically, this script sums up the file ...
8
votes
3
answers
878
views
Modifying Titration Data analysis results
This is my first script that I've written. As a result, I'm sure there are extra lines that are unneeded, or maybe better more concise ways of doing things than I have done here. I have tried to add ...
8
votes
2
answers
2k
views
Python program to check if a set of points is at land or at sea
I have written a program that divides an geographical area up in cells with size 0.002 degrees longitude by 0.001 degrees ...
8
votes
2
answers
13k
views
Histogram of a string
I'm teaching myself Python and when a friend posted this sentence
Only the fool would take trouble to verify that his sentence was
composed of ten a's, three b's, four c's, four d's, forty-six e's,...
8
votes
1
answer
159
views
Python implementation of approximating the chance a particle is at a location after n steps in the cardinal directions
Recently, I became very interested in a probability practice problem in my textbook for my class. I decided to implement it in code and I think I got most of it implemented. Right now, I'm hoping to ...
8
votes
1
answer
1k
views
Ramachandran plot (plotting the torsion angles of protein backbone)
I would like to have some insights on the code I created. It would be really insightful for me to get some feedback about the code, what I should do differently, if there is an easier, more elegant ...
7
votes
1
answer
2k
views
Optimizing very simple piece of “Game of Life” code by taking advantage of NumPy's functionality
Here is the code as it stands right now:
...
7
votes
3
answers
328
views
Energy curve plotter
I am not much experienced in Python, just write some small script. All my codes are procedural. They work fine, and I always check them with pep8.
One of them is:
...
7
votes
2
answers
633
views
groupby in pandas and plot
I have a csv file that looks like this:
...
7
votes
1
answer
830
views
Calculating relay operating times, according to IEC 60255
The script below is used to determine relay operating times, as defined in the standard IEC 60255. The equation and relevant information can be found here.
...
7
votes
1
answer
300
views
Modularizing matplolib graphing based on a data dictionary
For plotting I often use a dictionary that contains my data of interest, regarding my numerical simulations. For example I have a numpy array - let's call it ...
7
votes
1
answer
143
views
Matplotlib real-time monitor with reversed time
I would like to share a matplotlib real-time monitor plot that I needed for another application. The basic trick is to reverse the time, so that t=0 is now and t=...
7
votes
1
answer
697
views
Double pendulum real time plot
Double Pendulum
I made a little application that embeds a matplotlib dynamic plot into tkinter that enables control through the ...
7
votes
1
answer
137
views
Outputting scatter plots [closed]
I have written a python function that outputs scatter plots using Matplotlib after processing the data a little. It works but it's painfully slow. I was wondering if anybody had any suggestions as to ...
7
votes
1
answer
9k
views
Show weekly and daily variations in time-series data
I've got some time-series data. I want to examine the weekly and daily variation of that data. For weekly data I can make a plot like this, with the days along the horizontal axis:
For daily data I ...
7
votes
1
answer
246
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 ...
7
votes
1
answer
173
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 ...
6
votes
2
answers
3k
views
A Python script to plot data and save to PDF
I have a very simple Python script. All it does is open two data files from a given directory, read the data, make a series of plots and save as PDF. It works, but it is very slow. It takes almost 20 ...
6
votes
1
answer
461
views
Implementing a joint differential equation and eigenvalue solver
I've written a Python script to solve a system of coupled differential equations and then use the results to solve an eigenvalue problem. The full problem is:
\$\frac{d^2}{dr^2} K(r) = \frac{K(r)}{r^2}...
6
votes
2
answers
149
views
MCMC Metropolis Hastings for German Tank Puzzle
I have implemented the following Markov chain Monte Carlo MCMC
algorithm for the German tank puzzle found here.
I just want to make sure everything is legit and that I am not getting the right answer ...
6
votes
1
answer
403
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 ...
6
votes
2
answers
129
views
Slack User Interaction Graph – Collaboration Topology
I’ve written a small Python module to generate mock Slack workspace data, build a user–user interaction graph, and surface complementary collaborators based on skill sets.
The key features are:
Data ...
6
votes
1
answer
339
views
Probability of event using Central Limit Theorem + plotting results
I've been doing a Udemy course called: "Statistics for Data Science" and I decided to solve one of the homework with Python to kill two birds with one rocket #elon.
The task was:
The team of ...
6
votes
2
answers
362
views
Covering array scraper and sorter
A covering array is an \$N \times k\$ array in which each element is a from a set of \$v\$ symbols, and for every \$t\$ columns, every possible set of \$v^t\$ choices of the symbols appears at least ...
6
votes
1
answer
294
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 ...
6
votes
1
answer
700
views
Animation of sorting algorithms
I have created a visualisation of sorting algorithms using tkinter and matplotlib. Please let me know what you think and if you have any suggestions or find errors.
The aim of this code is to create ...
6
votes
1
answer
3k
views
Solver for some simple tangrams
I decided to write a program to solve Tangram puzzles. This went a bit out of hand and I ended up with 600+ lines of code. I don't think it should have taken so much code.
Here is an image of a ...
6
votes
1
answer
882
views
Prepare data for a contour plot with matplotlib
My question concerns the following Python code which is already working. As far as I have seen, there are very elegant solutions of compacting code. Do you have any ideas on how to make the following ...
6
votes
1
answer
417
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.
...
6
votes
1
answer
608
views
Schelling's model of Segregation Python implementation with Geopandas
If you don't know what is Schelling's model of segregation, you can read it here.
The Schelling model of segregation is an agent-based model that illustrates how individual tendencies regarding ...
6
votes
1
answer
3k
views
Computing the autocorrelation between 2D time series arrays in python
I have a list of 2D arrays which comes from a time evolution PDE (in \$(x, y, t)\$) that I solved numerically. There are \$k\$ arrays, which all have the same dimensions, and the arrays correspond to ...
6
votes
1
answer
2k
views
Plotting text from a dictionary with Matplotlib
I have the following dictionary:
...
6
votes
1
answer
1k
views
3-D plot of rectangular surface using matplotlib
I have made a 3D mesh. See below:
And the code below:
...