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
5
votes
1
answer
386
views
Read in file, filter out records, output results
I have been working on a project for some time and have let one Python file grow into a huge file that tries to do everything. The structure is pretty flat, and I don't like it. I've used other ...
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 ...
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 ...
2
votes
0
answers
114
views
Profiling for Bézier curve calculations
Recently I posted an answer on a question about Bézier curve calculations. As a micro-synopsis: there are three implementations of De Casteljau's algorithm here, including the original poster's, AJ ...
3
votes
1
answer
66
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 ...
4
votes
1
answer
88
views
Function that plots data frames, supporting several variants
I defined a function that generates tables and creates countplots and barplots based on the arguments that it receives. But the snippets of code inside the function are repeated several times, which ...
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 ...
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 ...
2
votes
1
answer
124
views
Simulated Annealing to the Travelling Salesman Problem: plotting graph of temperature vs. cost and animating using cv2
I am implementing Simulated Annealing to the Travelling Salesman Problem, plotting a graph of temperature (x axis) and cost (y axis) and animating using cv2.
...
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=...
5
votes
1
answer
152
views
Sum, validate, and plot monthly inventory levels
The idea is that I have a subset of the movements of material of a factory (over 700k rows), and I want to separate these movements by the reference of each product to plot the stock of each product ...
3
votes
1
answer
98
views
Industrial Practices for Time-Series Forecasting
I have code here for predicting temperature across months. This is the dataset that I was using: https://www.kaggle.com/sumanthvrao/daily-climate-time-series-data
I used a SARIMA model, and looking at ...
6
votes
1
answer
159
views
2048 game in Matplotlib
I did an OOP to make the 2048 game using Matplotlib visualization. The color dictionary is for setting different colors to each number in the game.
There are two ...
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:
...
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}...
4
votes
1
answer
361
views
Increase Matplotlib performance of redrawing
I have written an error analyzer in Python for the product of our company.
I want to read the log from our device and parse it, On Y axis there are different components of the device, and on X axis ...
4
votes
1
answer
4k
views
Barrier Option Pricing using Python
This is my implementation of pricing an exotic option (in this case an up-and-in barrier option) using the Monte Carlo simulation in Python. I use NumPy where I can. Any ideas to optimize this code?
<...
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 ...
1
vote
1
answer
118
views
Demonstrate the central limit theorem
I am new to Python, so I am interested in knowing if I am efficiently using Python for this project.
This program is meant to simulate the Central Limit Theorem. It uses sliders to adjust the number ...
4
votes
0
answers
586
views
Time distribution of Twitter data
The tweepy.models.Status class creates a 'tweet' object, it has attribute .created_at which is the posting time of the tweet in ...
5
votes
1
answer
313
views
Image processing and plotting
I wrote a program for analyzing pictures. The problem I'm having is very slow processing time for medium images like 800x800. I think the root of the problem for this is the ...
4
votes
1
answer
2k
views
Create histogram with greater than symbol in x axis in pyplot
I wanted to create a histogram from a list of positive integers. I want to bin it so that I show all single numbers, say K through N, with more than k elements in the data set, as well as the number ...
4
votes
1
answer
2k
views
Histogram output from parse of json-ish data in python
The idea is exploratory data analysis, the output rendered as a histogram to get an idea of relative frequency of records:
The example data set looks like this:
...
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,...
5
votes
1
answer
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 ...
5
votes
1
answer
131
views
Data set generation with Python and Matplotlib
I want to use Python and Matplotlib to create a data set of images. I want to do this by transforming the plot to a numpy matrix. At the moment it takes about 0.1 second to generate 100 images of size ...
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 ...
4
votes
1
answer
211
views
Live plot with many subplots
I have a stream of sensor data which I want to visualize in a plot with many subplots. Plotting the data is a real bottleneck in my code. Right now I get with small resolution only 16 FPS which is far ...
3
votes
1
answer
121
views
Time-dependent state machine with two outputs
Given a class BasicDataFeed whose purpose is to feed questions and answers into an artificial neural network, which is tested in a non-negotiable manner as follows:
...
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 ...
3
votes
1
answer
126
views
matplotlib color N-slope-normalization
Based from the source code of the TwoSlopeNorm color normalization of matplotlib, I tried to implement a more general normalization that can handle any number of &...
3
votes
1
answer
154
views
Collatz conjecture plots (python)
I have tried to improve my code with the suggestions I recieved in my old question about Collatz conjecture
Here is the new code:
...
4
votes
3
answers
761
views
Plotting Collatz conjecture values - Python
I am writing a program to display the behavior or certain seeds when you apply the Collatz conjecture algorithm to them.
I would like to know what I should change and also if there is a way to see ...
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 ...
4
votes
2
answers
372
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 ...
1
vote
1
answer
118
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 ...
2
votes
2
answers
3k
views
Colorbar for Matplotlib 3D patch plot
I am trying to make a 3D grid plot in Python using Matplotlib. The grid consists of hexahedral cells (with qudrilateral surfaces). The surfaces should be colored according to their height, that is: ...
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 ...
2
votes
1
answer
91
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 ...
1
vote
1
answer
58
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 ...
3
votes
1
answer
87
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 ...
7
votes
2
answers
633
views
groupby in pandas and plot
I have a csv file that looks like this:
...
2
votes
1
answer
252
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 ...
1
vote
1
answer
172
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 ...
1
vote
1
answer
65
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 ...
1
vote
1
answer
125
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 ...
1
vote
1
answer
119
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 ...
3
votes
0
answers
101
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
...
2
votes
0
answers
835
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 ...
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 ...