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
3 votes
0 answers
20 views

Plot a 2D vector field with radial symmetry in Python

I computed a 2D vector field 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 solved using ...
user avatar
  • 151
-1 votes
0 answers
17 views

Show values of lollipop-chart [closed]

I'm new to visualizing data and I'm trying to make a lollipop chart just like this one: data visualization - What is the name of this plot that has rows with two connected dots? - Cross Validated But ...
user avatar
5 votes
0 answers
51 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 ...
user avatar
1 vote
1 answer
32 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 ...
user avatar
  • 155
-1 votes
0 answers
11 views

FigureCanvasTkAgg performance in tkinter

I am making the simple tkinter application. There is a button, with each click, it get the next json file and plot its data into canvas. It is working perfectly but the problem is after plotting 10 to ...
user avatar
  • 185
2 votes
0 answers
34 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 ...
user avatar
  • 1,142
2 votes
1 answer
79 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 ...
user avatar
  • 163
4 votes
1 answer
96 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 ...
user avatar
  • 41
6 votes
1 answer
73 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. ...
user avatar
  • 63
3 votes
1 answer
65 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 ...
user avatar
  • 215
4 votes
1 answer
72 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: <...
user avatar
  • 215
4 votes
0 answers
445 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 ...
user avatar
2 votes
1 answer
54 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)....
user avatar
  • 581
2 votes
1 answer
155 views

Implementing histogram in python

I was trying to implement my own version of matplotlib's hist function and I came up with this: ...
user avatar
1 vote
1 answer
55 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 ...
user avatar
  • 69
5 votes
1 answer
80 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 ...
user avatar
4 votes
0 answers
75 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 ...
user avatar
  • 41
3 votes
1 answer
101 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 ...
user avatar
1 vote
1 answer
26 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 ...
user avatar
4 votes
0 answers
168 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 ...
user avatar
3 votes
1 answer
76 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 (...
user avatar
2 votes
0 answers
443 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 ...
user avatar
  • 57
0 votes
1 answer
148 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 ? ...
user avatar
2 votes
2 answers
98 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 ...
user avatar
  • 147
2 votes
1 answer
46 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, ...
user avatar
1 vote
0 answers
31 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 ...
user avatar
  • 47.9k
1 vote
1 answer
99 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 ...
user avatar
  • 11
1 vote
1 answer
59 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 ...
user avatar
0 votes
1 answer
128 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 ...
user avatar
0 votes
1 answer
883 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: ...
user avatar
4 votes
0 answers
77 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 ...
user avatar
  • 1,142
0 votes
1 answer
65 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 ...
user avatar
2 votes
0 answers
26 views

Data Visualization (rendering env)

How can I improve this code? It renders a ML env with openAI gym and matplotlib. I am new to coding so not sure if my variables or format or any lines can be improved. ...
user avatar
  • 21
4 votes
1 answer
216 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 ...
user avatar
2 votes
0 answers
17 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 ...
user avatar
  • 21
3 votes
1 answer
247 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. <...
user avatar
  • 131
5 votes
1 answer
264 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 ...
user avatar
  • 101
-2 votes
1 answer
69 views

This code demonstrates the central limit theorem. Is this code "Pythonic"?

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 ...
user avatar
2 votes
0 answers
51 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 ...
user avatar
  • 47.9k
5 votes
1 answer
2k views

Tkinter GUI for running HPLC pumps, real-time data visualization

What I made I used Tkinter to write a GUI to run some HPLC pumps for my work. The application sends some messages to the pumps via serial connections, reads a response, then logs data to a csv file. ...
user avatar
  • 83
3 votes
1 answer
735 views

Plotting the integer values in text format in matplotlib piechart

I have done a clustering algorithm and represented the results in a pie chart as shown below. ...
user avatar
  • 33
6 votes
1 answer
554 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 ...
user avatar
  • 91
2 votes
1 answer
546 views

Forex Simulator in Python using pandas and matplotlib

Description: This would make a first part of a currency exchange simulator The first phase includes downloading currency historical data from histdata.com api, plotting given period and given time ...
user avatar
8 votes
3 answers
662 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 ...
user avatar
  • 427
1 vote
0 answers
61 views

Basic peak editing with matplotlib

Usually I have really noisy datasets, so peak detection is quite hard to do just with coding. However the human brain immediately sees what is just random noise. I decided to make a basic peak editing ...
user avatar
3 votes
1 answer
85 views

Plot timings for a range of inputs MkII

To celebrate questions getting more reputation points per upvote, I revisited my previous question, Plot timings for a range of inputs. Since the time of that original question (more than two years!),...
user avatar
  • 40.5k
5 votes
1 answer
2k views

Plotting shapely polygon in matplotlib

When working with geometric objects I like working with the shapely module (Shapely - PyPI). In here it is easy to create polygons and define union, intersection and differences. Like so: ...
user avatar
13 votes
2 answers
2k 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 ...
user avatar
2 votes
1 answer
1k views

Binary file reading and plotting data

This code reads binary file. Read data is converted into signed values and gets plotted if the user wants it. Data looks as below: ...
user avatar
12 votes
1 answer
3k 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 ...
user avatar
  • 405