414 questions
1
vote
1
answer
1k
views
Is it possible to have interactive plots in Emacs?
I was trying to use Emacs as my editor for my research (I followed all steps in Jon Fincher’s guide on Realpython : [https://realpython.com/emacs-the-best-python-editor/]).
I use jupyter notebooks a ...
1
vote
1
answer
203
views
How to create a lineplot animation [duplicate]
I have a pandas DataFrame that looks:
d = {'time': [1, 3, 5,7, 9, 11, 13, 15, 17, 19],
'method1':[0.864231038, 0.874805716, 0.890315836, 0.906831719, 0.91634293, 0.928120905, 0.938231839, 0....
0
votes
2
answers
246
views
the matplotlib graph is breaking after my custom x axis labels exceed 50
i am developing a weather monitoring program and i am stuck at a problem. the problem is when the array that contains the labels for the x axis exceeds the lenght of 50 the graph starts to break. and ...
1
vote
1
answer
62
views
Animating a set of lines in a class
I have a class in which I used one of the codes in StackOverflow,
this link :Managing dynamic plotting in matplotlib Animation module
Now I want to edit this class and add some parameters to the class,...
0
votes
0
answers
67
views
Tkinter/Matplotlib inconsistent behaviour between debugging and 'release'
Preliminaries
Python: 3.11.1 x64
tkinter: 8.6
matplotlib: 3.6.2
VsCode 1.77.2 on Windows 10 21H2
Summary
I have a simple app that plots a graph on a tkinter canvas, records the image and then ...
1
vote
1
answer
547
views
How to add the colormap to the matplotlib 3d plot
I want to add the colormap to show the gradient along x axis but unfortunately the whole figure turns black. I might be lacking something kindly help me in this. Here is the code.
import matplotlib....
0
votes
1
answer
274
views
Matplotlib animation.artistanimation showing all plots at once for inital figure
I want to create live plots of my results and found this SO question which did most of the job: Matplotlib animation update title using ArtistAnimation
BUT, when I start the script, the first figure ...
0
votes
0
answers
280
views
Combine matplotlib slider and funcanimation
I have an animation working well with FuncAnimation. My goal is to change a parameter with a slider and update the animation instantly. I don't know how to combine both. You'll find my code down here, ...
0
votes
0
answers
17
views
Unsure of which of my parameters is a module when trying to use PLT to do animate a random walk
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def rectangle_random_walk3(n, w, l):
bounces = 0
x = 0
y = 0
path = [(x, y)]
for i in range(n):...
0
votes
1
answer
79
views
FuncAnimation: Cannot animate a point and a line at the same time
I am trying to make an animated plot to show the behavior of a simple harmonic oscillator. I would like for this animation to be a combination of the following two plots. That is, I would like the red ...
0
votes
1
answer
3k
views
How would you go about plotting this data in 3d over time?
So,
The data looks like this:
(the spaces represent different columns, and the data represents 10 particles going around a central particle "Sun" and at different time steps in this case ...
0
votes
1
answer
368
views
Trying to animate persistent homology in python
I am trying to write a program that will run a persistent homology animation on some random data. Here is the code that I have so far:
import numpy as np
from ripser import ripser
import matplotlib....
1
vote
1
answer
270
views
Why do i get a FileNotFoundError when trying to save a file?
I am trying to save a matplotlib animation but i always get a FileNotFoundError.
import matplotlib.animation as animation
anim = animation.FuncAnimation(fig, plot_update, frames = vel, init_func = ...
-2
votes
1
answer
46
views
how do I combine two 3d real time graphs into one?
Using matplotlib.animation.FuncAnimation, I made two 3d real-time graphs.
I want to combine the two graphs into one.
When I tried to find similar examples, I could only find examples of 3d graphs, not ...
0
votes
1
answer
245
views
How to plot multiple animations in Matplolib for 2 different sources
In a measurement chain, each instrument embedded in various measurement loops will record a CSV and I want to monitor the live plots in separate figures i.e figure 1 for instrument1 , figure 2 for ...
1
vote
1
answer
928
views
Animate labels using FuncAnimation in Matplotlib
I am not able to make (animated) labels using FuncAnimation from matplotlib. Please find below a minimal code that I made. ax.annotate has no effect at all - the animation itself works though. What ...
0
votes
0
answers
241
views
Matplotlib Animation Not Saving
I have a Finite Difference Simulation that is plotted with the following command:
anim = ani.FuncAnimation(fig, update, init_func = init, frames = np.linspace(0, t_max, int(t_max / dt + 1)), repeat = ...
0
votes
1
answer
565
views
Scatterplot animate trajectory with fading trail
I have a df containing x,y coordinates of a mouse's snout that I want to use for an animated scatterplot. Currently, I have the code for a static scatterplot.
import pandas as pd
import numpy as np
...
1
vote
0
answers
147
views
Matplotlib transparent background without save() function
I have this kind of an animation and I want to integrate it to my GUI.
here is the plot
But, the background color is set to black right now. Here is the code. I am using Windows 10 and for GUI I am ...
0
votes
1
answer
231
views
Spinning globe GIF with cartopy
I'm failing to find the most efficient way to generate a simple animation of a spinning globe with a filled contour using cartopy. The following code yields a static gif, probably because the figure ...
0
votes
0
answers
44
views
Live Matplotlib plot is empty
def simulate(foo):
plt.cla()
for key in plotdata.keys():
plt.plot(plotdata[key],label = key[:-1],color = key[-1])
#do some stuff with data
ani = ani.FuncAnimation(plt.gcf(), simulate, ...
1
vote
3
answers
96
views
Removing duplicates from animation's lened of a 3d plot in python
I am exporting an animation in python but the legend is repeating. I have only one plot and want to have one single legend item in every frame of the animation. This is my script:
import numpy as np
...
1
vote
0
answers
114
views
Network graph In Matplotlib?
I had a question about python matplotlib I wanted to know in this library Is it possible to make grid diagrams in which circles are drawn and connected and intersected by lines? In the network graphs ...
0
votes
1
answer
816
views
How to playback audio segments in Python and follow it in a MatPlotLib chart?
OS: Windows 11
Python: 3.9
I can extract a number of audio features from .WAV files by using OpenSMILE and plot them with MatPlotLib. I can also select segments by clicking that chart (like, a segment ...
0
votes
1
answer
226
views
Change data of matplotlib 3D scatterplot after construction
I have a 3d scatterplot that needs updating.
however, there is no variable that lets me address single datapoints.
self.fig = plt.figure(figsize=(8, 8))
self.ax = self.fig.add_subplot(111, projection='...
2
votes
0
answers
443
views
Matplotlib+Jupyter stops rendering animation when run inside a function
After getting a matplotlib animation to run successfully inside a Vscode Juypter notebook cell, I decided to refactor the matplotlib animation code into a function but this causes the matplotlib ...
1
vote
1
answer
468
views
Bar Chart Race with matplotlib: Bars changing colors
I’m trying to write a Bar Chart Race with matplot. I don’t use the "bar_chart_race" library because I need more options for customization later. But I use the basic explanations of the same ...
3
votes
3
answers
627
views
How to move a patch along a path?
I am trying to animate a patch.Rectangle object using matplotlib. I want the said object to move along a path.Arc.
A roundabout way to do this would be (approximately) :
import numpy as np
from ...
1
vote
1
answer
2k
views
Missing Matplotlib Animated Figure in VSCode Jupyter Notebook
I am trying to create a simple matplotlib animation in a Jupyter notebook running inside vscode.
%matplotlib notebook
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
...
0
votes
1
answer
2k
views
FuncAnimation doesn't display animation
I have code that is running on a different machine.
%matplotlib widget
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
n = 100
x = np.random.randn(n)
def ...
1
vote
0
answers
168
views
matplotlib's ion() does not make any difference
To test the matplotlib's interactive mode, I used the following two code snippets:
Snippet 1: Has plt.ion() with no call to fig.canvas.draw():
import numpy as np
import matplotlib.pyplot as plt
x = ...
1
vote
1
answer
367
views
How to matplotlib blit artist outside axes?
https://matplotlib.org/stable/gallery/event_handling/cursor_demo.html
Im trying to make a cross hair cursor with a annotation on the right axis to show the Y-value
everything works fine except when ...
0
votes
1
answer
93
views
Animated MatPlotLib Frame Update Bug
I am attempting to make an animated plot of a theoretical Falcon 9 disaster trajectory due to an engine failure. However, my code, shown below:
import numpy as np
from scipy.integrate import solve_ivp
...
1
vote
1
answer
134
views
Matplotlib changing underlying data for scatter plot with widget buttons
I have a plot in which I want to plot the following two data sets
x1,y1 = np.random.normal(0,1, (2,20)) # dataset 1
x2,y2 = np.random.normal(0,1, (2,20))
# Next, I create a plot and the ...
1
vote
0
answers
241
views
Why is my animation deleted before rendering?
I try to animated live data. It used to work but now it does not. I have the following code:
import subprocess
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
def plot(i)...
0
votes
1
answer
61
views
(matplot, 3d, plot_surface, Animation) How can I freez z axis from moving in the animaton
I want to make an animation of a drum vibration in python. My problem is that the zero point of the z_axis keeps moving. How can I freeze the z_axis? video link
fig, ax = plt.subplots(subplot_kw={&...
3
votes
1
answer
9k
views
'FuncAnimation' object has no attribute '_resize_id'
I am trying to plot a single pendulum using Eulers method and with given theta values and formula in python but I am getting an Attribute error on FuncAnimation saying 'FuncAnimation' object has no ...
1
vote
0
answers
54
views
Earthen Dam Failure Cellular Automata Simulation Using Python
i am working on a cellular automaton to simulate in 2D an earthen dam failure using python, the simulation is supposed to show step by step the process by setting 1. the cellular state. 2. defining a ...
3
votes
1
answer
286
views
animate network graph
I would like to draw a dynamic network to show how it changes over time as new observations are added.
I've found how to animate a network given two single states (here called s_pos, t_pos), but what ...
0
votes
1
answer
48
views
How to plot a circle that tilts according to a function
import numpy as np
import matplotlib.pyplot as plt
from io import BytesIO
from PIL import Image
r = 18
h = 1.7
num_of_steps = 1000
emp = 3
time = np.arange(0, 100, 0.4)
phi = []
theta = []
Amp = np....
1
vote
1
answer
142
views
Determine Shortest Distance between two moving points
Im am trying to produce the shortest distance between the two orbiting points (Earth and Jupiter) created by this orbital model. I'vebeen working on this for quite some time but have been struggling.
...
2
votes
0
answers
1k
views
matplotlib AttributeError: 'NoneType' object has no attribute '_get_view'
I'm trying to animate the collision physics of N number of balls in matplotlib, but when I try to run the program, I get an AttributeError: 'NoneType' object has no attribute '_get_view' error. How ...
0
votes
1
answer
621
views
Unable to refresh plt.axhline() in matplotlib
I'm just trying to make a live graph using matplotlib.However I couldn't find a way to draw-remove-redraw axhline(). My aim is to show a horizontal line of newest value of Y axis values and of course ...
1
vote
1
answer
470
views
How to animate a 3D plot, defined with three functions x=(), y=(), z=()?
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import mpl_toolkits.mplot3d as Axes3D
r = 20
h = 1.7
phi = np.linspace(0, 4*np.pi, 1000)
theta = np....
0
votes
1
answer
41
views
Combining a text update with n curves being updated using matplotlib animation
I have n curves that I draw using matplotlib's animation. Thanks to a previous question and the answer to it, this works well. Now I want to add some text in the plot which is continuously updated, ...
1
vote
1
answer
314
views
How to animate n curves in a plot using matplotlib's animation?
I have n curves that I want to draw using matplotlib's animation (each curve corresponds to a gpx file recorded with a fitness tracker or a smartphone). It works well when using only one track or two ...
-2
votes
1
answer
45
views
I'm trying to plot a data which should be displayed as a plasma effect. But seems I'm having trouble here
c = np.cos(20)**2
d = np.sin(20)**2
x = np.linspace(-np.pi,np.pi)
y = np.linspace(-np.pi, np.pi)
z = np.abs(np.cos(20 * (c + d)))
x,y = np.meshgrid(x,y)
plt.imshow(z)
So this is the code so far. It's ...
1
vote
0
answers
64
views
Difficulty to insert an interactive figure inside Tkinter
I'm struggling with this issue for some time so I have decided to finally ask here.
First of the code is available at this adress: https://github.com/ChrisZeThird/Game-Of-Life/tree/main/ObjectOriented ...
3
votes
1
answer
683
views
Getting two graphs using matplotlib animation instead of one
I am trying to plot world population map using geopandas and matplotlib. I also use matplotlib animation to make graph animated for each year.
import matplotlib.ticker as ticker
import matplotlib....
0
votes
1
answer
43
views
Update bubble plot using Arduino serial data
Hi I'm new to this Site and appreciate your help. I have a variable resistor and it reads analog value and send to the python script. My objective is to plot this value using bubble plot which ...