All Questions
Tagged with matplotlib animation
1,304 questions
0
votes
1
answer
38
views
FuncAnimation only shows one frame
I am trying to implement a genetic algorithm in Python and to display the result of my algorithm I wanted to create an animation using FuncAnimation from matplotlib.animation.
However, I ran into the ...
0
votes
1
answer
62
views
How can I animate object A thrown upwards from an given height then free-falling with matplotlib?
Using Python 3.12, Matplotlib 3.9.2,
From height h=20(m), throw object A upwards with a given velocity v and drop object B to let it free-falling. Air resistance is neglectable. Calculate v so that ...
1
vote
1
answer
48
views
Speed-up matplotlib creation of frame images for animation
I am simulating some physical processes with Python and wish to regularly plot the situation of the system in order to make an animation. What I have been doing so far is to draw a snapshot of the ...
0
votes
0
answers
36
views
Func.Animation plots a blank plot
We have gathered data from lasers measuring the displacement of a target that moves.
One laser for the lateral movement and one for the vertical movement.
From this data I want to animate the target's ...
0
votes
0
answers
37
views
How to forcefully trigger updates for dynamic plots in Google Colab without user interaction?
I'm trying to create responsive dynamic plots in Google Colab, but I'm running into performance issues with the updates.
For a minimal example, I made a simple scatter plot of random values with a ...
1
vote
1
answer
85
views
Epicycloid animation with Matplotlib in Python
I want the animation epicycloid.gif to be framed depending in the size of the epicycloid, so depending on the radio of the spinning circule. As you see at ratio = 2 the animation in format .gif does ...
0
votes
0
answers
34
views
MatPlotLib dynamical resizing of y-axis not working in animation?
I have the following animation code:
# Update function for animation
def update(frame):
line.set_ydata(psi_vals[frame]) # Update the y-data for each time step
# ax.set_ylim(0, np.max(psi_vals[...
1
vote
2
answers
48
views
Changing colorbar and title in animated plot
I'd like to change the title and the colorbar for each plot in my Artist animation. But in the final .gif it is only showing the title and colorbar of the last frame.
Any idea what I am missing here?
...
0
votes
1
answer
55
views
How to dynamically update a bar plot in Python
I have a barplot that I'd like to update dynamically using data from a dataframe.
The original plot is based on dataframe, d:
d
Position Operation Side Price Size
1 9 0 1 0.7289 -19
...
0
votes
1
answer
22
views
Animating a cluster column and line chart with matplotlib
I am trying to make an animated chart that updates frame by frame to have the end result has two columns for each x-axis entry (which does vary between years or years and Q, but either way are strings)...
0
votes
1
answer
55
views
Animating line charts
I have the following data, here is a section of it
[{'Date': '2017 Q1', 'Saudi Arabia': 3.5080621303094413, 'Oman': 2.0803722435647836, 'Yemen': 1.9636651338439473, 'Israel': 3.0247692259733565}, {'...
0
votes
1
answer
99
views
Update tile/image based on extent using Cartopy and Matplotlib FuncAnimation
I want to create an animation of a trajectory using Cartopy and FuncAnimation. I have the trajectory stored in a GeoDataFrame with latitude, longitude and date time columns, which I want to visualise.
...
0
votes
2
answers
94
views
How do I create an animated stacked bar chart using matplotlib
I have been trying to create an animated stacked bar chart using matplotlib. Although I have managed to animate each stack element, the output only shows one element at a time. I was also able to ...
0
votes
0
answers
27
views
How do I include figure text outside the plot in matplotlib animated chart?
I am trying to include a figure text outside the plot @(0.15, -0.25). This works in a normal chart. But when I try yo animate this, it gets eliminated. Basically anything that is outside the plot (...
3
votes
1
answer
69
views
Making an image move in matplotlib
I'm trying to have an image rotate and translate in matplotlib according to a predefined pattern.
I'm trying to use FuncAnimation and Affine2D to achieve this. My code looks something like this :
from ...
0
votes
1
answer
42
views
Patches animation in matplotlib
I'm trying to create a simple particle animation using matplotlib, like this:
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
fig = plt.figure()
fig.set_dpi(...
1
vote
1
answer
50
views
Animation for plotting y=omega*x^2 with omega varying from -3 to 3
I want to plot y = omega*x^2 with omega varying from -3 to 3 with a step size of 0.25 (and x spanning -4 to 4 with a step size of 0.001). The current version of my code (below) only has omega start at ...
0
votes
1
answer
86
views
Make animation using Python but give me an error, animation can't appear
I want to plot animation of y=omega*x^2, which omega is -3 into 3 with step size 0.25, x from -4 into 4 with step size 0.001. I'm new studying plot animation in Python.
I try to make a code but give ...
2
votes
1
answer
73
views
How to show one figure in loop in Python?
I want to show a figure that is calculated in a loop, let say with 5 iterations.
This is the code that I wrote
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,1,100)
y = np....
0
votes
1
answer
53
views
Matplotlib animation by using for loop
I have a project about robotics arm and I need to visualize motion of robotic arm. I have a code for taking coordinates and visualize it but I want a animation for it. I used for loop but I couldn't ...
1
vote
1
answer
80
views
How to create an animated 2D histogram chart in python
I have the code to create my 2D histogram as below. It works for creating a statics chart but I need to create an animated heatmap which change with 'minute_play' column. How can I do that? The ...
1
vote
1
answer
297
views
Best way to make an animated line plot in streamlit?
I'm new to Streamlit and am trying to create an animated line plot. However, my data is quite heavy: I have 40 data points on the x-axis, and at each time instance, I am plotting 50 lines (the ...
1
vote
0
answers
34
views
Matplotlib stackplot animation
I'm creating an animation of a line plot using the attached code. I want to display the data as a stackplot instead of multiple lines on the same plot. When I change the plot type to a stackplot I ...
3
votes
2
answers
168
views
Matplotlib's `line.set_data_3d()` is slower upon reloading the graph
I'm making a website in which users can input one NBA player and get an animation of their shots. The code is working properly, but when I load another NBA player (or the same NBA player the second ...
0
votes
0
answers
27
views
'update lines' function in 3d animation
I am trying to animate in 3D an arm represented by 2 segments (3 points A, B and C of which I have 3D coordinates in a numpy array (shape (n,3))). Only the arm at instant t (between 0 and n) should be ...
0
votes
0
answers
16
views
Can I animate a Poly3DCollection in matplotlib with blit=True
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from scipy.spatial.transform import Rotation
import matplotlib.animation as animation
...
2
votes
1
answer
103
views
Changing the color scheme in a matplotlib animated gif
I'm trying to create an animated gif that takes a python graph in something like the plt.style.use('dark_background') (i.e black background with white text) and fades it to something like the default ...
0
votes
2
answers
353
views
Save matplotlib as mp4 in python
from matplotlib import pyplot as plt
import numpy as np
import matplotlib.animation as animation
fig = plt.figure()
axis = plt.axes(xlim=(0, 4), ylim=(-1.5, 1.5))
line, = axis.plot([], [], lw=...
1
vote
0
answers
34
views
How to save several figures from an animation created by FuncAnimation?
is it possible to save, for instance, 10 figures from a video, that is created as follows?
ani = FuncAnimation(fig, update, frames=num_frames, interval=40, blit=True) # Interval is in milliseconds
...
0
votes
0
answers
27
views
attempting to save FuncAnimation changes the animation
I am attempting to create and save an animation of a time-varying vector field using matplotlib's FuncAnimation. When I run the animation without attempting to save it, it updates smoothly as ...
0
votes
0
answers
12
views
matplotlib dynamic text by last value
hello i want to create a matplotlib animation and i used this code:
fig, ax = plt.subplots(figsize = (17,12))
plt.rcParams.update({"font.family":"Sahel", "font.size":26})
...
0
votes
0
answers
43
views
matplotlib animation not updating the plot
I've create a plot that contains a number of circle patches. I wanted to animate the plot, shifting the colors of the circles with each frame. My animation function is being called, and, in the ...
1
vote
1
answer
35
views
Using matplotlib and function animation Unable to rotate all the electrons in an atom model
I am trying to create a matplotlib animation with points at N, W, E, S, NW, NE, SW, and SE to run in a loop (like 8 electrons in an atom shell). While N, W, E, and S are working, NW, NE, SW, and SE ...
0
votes
1
answer
109
views
Updating x/y/z limits in matplotlib Animation 3D
I came to this problem when I tried to adjust the limits of the axis in the 3D animation. It seemed that the range of the limits on the screen is not what I want, but the output of the limits on the ...
0
votes
0
answers
23
views
Comparing 1st order and 2nd order Butterworth bandpass filter on dummy sensor data graph
I am generating dummy sensor data and comparing 1st and 2nd order bandpass filter impact on the signals using following code:
%matplotlib notebook
import matplotlib.pyplot as plt
import matplotlib....
0
votes
1
answer
144
views
How to animate this arrow on a tkinter canvas?
My python code below is based on the solution here.
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.animation as animation
import ...
2
votes
1
answer
73
views
how to show progression of changing subplot labels (plt.text) along with color changing in an ArtistAnimation
running python 3.9:
import matplotlib.pyplot as plot
import numpy as np
import matplotlib.animation as animation
fig, plt = plot.subplots()
myArray = np.array([[0, 1, 2, 3, 4, 5, 6],
...
0
votes
0
answers
24
views
FuncAnimation is unable to plot the data
I am trying to read the data from a .csv file and plot it in real-time. In the .csv file the data is being added every few seconds, I have verified that the data is being written and the .csv is not ...
0
votes
0
answers
38
views
Animation of an array with matplotlib library
I want to animate my array as a scatter plot, this is the shape of my data:
data = np.array([[[[1], [2], [7], [1]],
[[2], [4], [9], [1]]],
[[[5], [2], [8], [1]],
...
2
votes
1
answer
71
views
How to create an animated scatterplot in Python and safe as .mp4?
I have an array A in python which contains n x n x n matrices, on each position having either the value 1 or -1.
np.random.choice([1, -1], size=(n, n, n))
So say A contains 20 of these matrices. I ...
1
vote
0
answers
27
views
Error in saving animation using matplotlib
I'm trying to run this particle swarm optimization code in python, I am able to run the algorithm itself but trying to save the animation of the algorithm keeps producing an error.
import random
...
1
vote
0
answers
134
views
Optimizing Animation Saving Speed in Matplotlib
I have a large dataset containing x, y, z coordinates of limbs from multiple people over several frames. I am using Python with Matplotlib to visualize this data as an animation, where each frame ...
0
votes
1
answer
41
views
Why isn't the matplotlib animation showing up?
I'm generating an animation with matplotlib, but it simply isn't creating the GIF. It remains only a static and white image, as shown in the figure below:
How can I generate an animation so that it ...
1
vote
1
answer
130
views
How do I show animation in Jupyter?
I copied code from the manual:
%matplotlib notebook
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
fig, ax = plt.subplots()
t = np.linspace(0, 3, 40)
g = ...
0
votes
1
answer
64
views
Overlay two animations within the same window with FuncAnimation
I am writing a program which simulates the motion of the double pendulum. In order to make the impact of different initial values visible, I would like to overlay the motion of two double pendulums ...
1
vote
0
answers
32
views
Interface a 3d object with external sensor values for animation
I am trying to build a python code that can rotate a 3d cube based on the values from an external magnetometer
i have written below code to simulate motion of a 3d cube along x axis..how i can edit to ...
0
votes
0
answers
101
views
Animation scatter plot ( delete the previous point )
I would like to animate a scatter plot that just shows the current point and delete the last point. I already have a code that runs well but I don't know how to delete the previous point.
This is my ...
0
votes
0
answers
47
views
Matplotlib inline animation stops on chrome
I've been using matplotlib animation figures for a long time, however, it stops working after moving the chrome window to another monitor. It simply erase all figures.
Second, after a while i'm away ...
1
vote
0
answers
47
views
Matplotlib animation shows only a part of each figure
I create a chain of figures and save them into an animation.
My problem is that the image of the figure that I see on the screen is different from what is saved by savefig.
This problem is saved by ...
1
vote
1
answer
548
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 ...