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
6
votes
2
answers
108
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
437
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}...
3
votes
1
answer
109
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
133
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
710
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 ...
4
votes
2
answers
352
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
113
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
1
answer
76
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 ...
2
votes
1
answer
106
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.
...
1
vote
1
answer
46
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
81
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
625
views
groupby in pandas and plot
I have a csv file that looks like this:
...
2
votes
1
answer
237
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
150
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
51
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
117
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
109
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
95
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
823
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 ...
6
votes
0
answers
143
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 ...
1
vote
0
answers
327
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 ...
6
votes
1
answer
392
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 ...
7
votes
1
answer
234
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 ...
1
vote
1
answer
179
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 ...
2
votes
0
answers
108
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 ...
2
votes
1
answer
3k
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 ...
4
votes
1
answer
167
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 ...
6
votes
1
answer
406
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.
...
3
votes
1
answer
242
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 ...
4
votes
1
answer
430
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:
<...
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 ...
2
votes
1
answer
83
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)....
3
votes
1
answer
758
views
Implementing histogram in python
I was trying to implement my own version of matplotlib's hist function and I came up with this:
...
1
vote
1
answer
107
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 ...
7
votes
1
answer
166
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
1
answer
282
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 ...
3
votes
1
answer
128
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 ...
2
votes
1
answer
68
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 ...
4
votes
0
answers
594
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 ...
3
votes
1
answer
130
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 (...
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 ...
1
vote
1
answer
357
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 ?
...
2
votes
2
answers
118
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 ...
2
votes
1
answer
69
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, ...
3
votes
1
answer
89
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 ...
1
vote
0
answers
41
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 ...
1
vote
1
answer
123
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 ...
1
vote
1
answer
73
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 ...
1
vote
1
answer
204
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 ...