414 questions
-1
votes
0
answers
66
views
Matplotlib ffmpeg libopenh264 error in FFMpegWriter
When I try to use matplotlib's ``FFMpegWriter```.
import matplotlib.animation as animation
FFwriter = animation.FFMpegWriter(fps=10)
...
ani.save('./temp/animation.mp4', writer = FFwriter)
I get the ...
0
votes
1
answer
104
views
How to annotate with label in middle?
When I plot the following code with 3 subplots using matplotlib,
import numpy as np
import matplotlib.pyplot as plt
# ======================================
# Base ellipse parameters
# ==============...
0
votes
0
answers
47
views
Why does my animation become progressively slower?
I am working on an interactive animation that allows the user to select several market indexes and compare their performance. With 2-3 tickers, the animation works fine, but it still slows down ...
0
votes
0
answers
19
views
Fixed colorbar in a Matplotlib animation
I'm trying to generate an animation for a heatmap varying through a few years. I'm having issues because I don't know how to keep the colorbar from flickering like in this GIF.
This is the function I'...
3
votes
2
answers
200
views
matplotlib.animation.FuncAnimation lagging when resizing the plot window (more than 5 seconds)
The code below generates random data, and displays it in realtime with Matplotlib. The sliders allow the user to change the y-axis range. All of this works.
Problem: when resizing the window size or ...
0
votes
1
answer
85
views
Problems when using np.arctan2 to plot domain colored complex function
I'm a physics student. I'm trying to write a program to visualize complex functions in different ways using Python with matplotlib and numpy. I've written a class whose object takes as input, among ...
0
votes
1
answer
44
views
matplotlib animation breaks with conditional assignment in update loop
In Jupyter Lab on Windows, the matplotlib animation API documentation breaks when a no-op edit is added in the update loop.
%matplotlib ipympl
import numpy as np
import matplotlib.pyplot as plt
from ...
0
votes
0
answers
33
views
How to combine line graph with bar chart using matplotlib animated chart?
I am writing a python code where it shows animated 4 bar charts ( 4 subplots).
The code reads data from csvs which continuously gets updated.
The data has columns data["niftychainceoi"] &...
1
vote
1
answer
91
views
How to change the color of an individual bar in a MatPlot FuncAnimation?
In essence, I am trying to achieve this. But I'm struggling to understand how I might apply this to bars.
I'm trying to visualise sorting algorithms using matplot (taking user inputs the establish ...
1
vote
0
answers
20
views
multiple traces animation are not displaying, the code draws only one trace each running time?
trying to animate data of multiple trace using matplotlib animation but the result doesn't satisfy my request, I want to plot all trace of the steam simultaneously, but it draws only one trace each ...
0
votes
1
answer
73
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
53
views
I cannot animate the scatter plot in matplotlib. Every frame is the repeat of the first frame data plot
I am writing a python script to animate data from a list of .xyz files using matplotlib. However, the animation is actually static because each frame of the animation is displaying the data from the ...
3
votes
1
answer
3k
views
How can I use plt.ion()?
import matplotlib.pyplot as plt
import numpy as np
plt.ion() # Turn on interactive mode
x = np.linspace(0, 10, 100)
y = np.sin(x)
for i in range(10):
plt.plot(x, y * (i + 1))
plt.draw()
...
0
votes
1
answer
71
views
Load 2 Tkinter windows simultaneously. one with animation
The following script runs standalone to run a scenario:
The results are printed first, followed by the plot is closed with an animation.
import numpy as np
import matplotlib.pyplot as plt
import ...
0
votes
1
answer
51
views
ImportError: DLL load failed while importing _cext: Le module spécifié est introuvable
I write this
import matplotlib.pyplot as plt
x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
plt.plot(x, y)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Simple Plot')
plt.show()
But an issue has ...
0
votes
1
answer
48
views
Explaining Matplotlib Animation Script in Python: Constructing a Sine Wave Curve
Can someone explain this Python code to me?
I'm trying to understand the inner workings of this code, which generates an animated plot using Matplotlib. Here's a breakdown of what each part does:
...
1
vote
1
answer
70
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
250
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 ...
0
votes
1
answer
71
views
matplotlib animation not working with xlwings
i am having issues with matplotlib animations when using xlwings, example from matplotlib:
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
import xlwings ...
2
votes
1
answer
363
views
Plotting a Baseball Field Animation
I have a dataframe that includes position data from all 9 players on a baseball field including the hitter throughout a given play as well as the ball trajectory. I need some help with figuring out ...
4
votes
2
answers
407
views
Animating Yearly Data from Pandas in GeoPandas with Matplotlib FuncAnimation
Using this dataset of % change by state, I have merged it with a cartographic boundary map of US states from the Census department: https://www2.census.gov/geo/tiger/GENZ2018/shp/...
0
votes
1
answer
535
views
matplotlib animation aren't shown
When i try to run the matplotlib animation notebook animate_decay.ipynb from matplotlib.org, all i get is an empty figure: axes and a grid, but no line object which changes. There are no errors ...
0
votes
0
answers
105
views
Export animation with bokeh
In matplotlib, I can make a gif with “FuncAnimation” and export it with the method “to_jshtml()” that returns an HTML. The output adds a “scrubber” widget to the animation, which is great. Here is a ...
3
votes
2
answers
231
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
1
answer
501
views
Matplotlib animation script runs fine first time but gets stuck on re-runs until kernel is restarted
I'm trying to run an animation where a scatter plot is updated every timestep. I am working in a jupyter notebook in vscode (if relevant). The animation script, given below, runs great the first time ...
0
votes
0
answers
62
views
Problems using FuncAnimation to animate updating an array over many iterations
I'm working on a project and I got a piece of code to work in a for loop just fine, as it works in a for loop, it should work in a func for making an animation of the actual array instead of just as ...
0
votes
1
answer
77
views
How to set xlim when save some frames to file by matplotlib in python?
I use python and matplotlib to create bar chart race animation, the data is time series and keep update every day. I want only save updated frames to file, for example, the frames are 10460 unti ...
1
vote
1
answer
39
views
animate 1D data with LineConnection
The example code below creates 2 plots that attempt to convey what the desired animation is seeking to do. Note that the plot on the right is similar to the plot on the left, but represents the ...
0
votes
1
answer
168
views
How do I animate xarray data using matplotlib?
I am trying to animate a plot using matplotlib's FuncAnimation, however it never outputs anything. The data is NetCDF, precipitation rates for the USA with coords for day, x and y. The x is longitude ...
1
vote
1
answer
84
views
Jupyter Notebook - Can't update matplotlib plot in a for loop (keeping previous plots), nor animate the plot using animation subfunction
For a project, I need to plot the orbit of a particle around another in a Jupyter Notebook.
I succesfully managed to do this in a for loop, printing the result only when the for loop is finished. Here ...
0
votes
1
answer
37
views
Why are my subplots not positioned properly after animating them?
I'm answering module on image processing and I wanted to show how the values of a given 2D image change based on the intensity of the values of each pixel. The only thing is that I can't seem to ...
0
votes
1
answer
175
views
python, celluloid, camera.snap() does not save the actual figure state
The program draws a one-parameter set of straight lines in real time. If I want to save as a gif what the program has output using camera.snap(), then I do not get the desired result. The question is, ...
0
votes
0
answers
99
views
Pyplot colorbar not consistent when animating colormesh
I have tried various methods of animating a colormesh plot. I believe that FuncAnimation is the simplest way for me to animate my colormesh. The code I have written is shown below
r = np.linspace(0,R,...
0
votes
1
answer
30
views
Removing one of the xticks or xticklabels from a 2x1 subplot
I am making a GUI which shows a graph of 4 different readings. Right now the readings are randomly generated. I am using matplotlib and animation to show live readings, where 2 of the readings are ...
1
vote
1
answer
48
views
matplotlib only graphing to last graph
I am very new to python so I am sure my code looks a bit elementary. I have a vacuum chamber that I can communicate with via TCP commands. My goal for now is to plot pressure on one graph and ...
1
vote
1
answer
138
views
Time control bar for animation in matplotlib
On the matplotlib website, all examples to create animation include this control bar:
Which allows one to precisely select the time, to stop, and to play the animation in the desired direction. The ...
0
votes
1
answer
25
views
Why is my matplotlibanimation not plotting on tkinter?
I am trying to animate stock prices from a csv file on a matplotlib graph and embed this onto tkinter. The issue is that I can't seem to get it to work with tkinter.
The issue I am having is that it ...
0
votes
0
answers
50
views
My Particle Simulation is Slow and After While Does not work as Intended
The purpose of this code is to watch particles of random positions and velocities interact with each other but after a while when particles are getting very fast they start passing inside each other ...
0
votes
1
answer
142
views
Using `grab_frame` with `FFMpegFileWriter` Yields Error in the Figure Argument to Subprocess
I want to generate an MP4 file using frames produced by a rather complicated simulation. If I have to watch the movie as a side affect of generating it I will not complain too much, but would rather ...
1
vote
1
answer
111
views
why it is not possible use matplotlib.animation when data type within pandas dataframe is datetime due to your time stamp?
I'm experimenting with 1D time-series data and trying to reproduce the following approach via animation over my own data in GoogleColab notebook.
I faced the problem of re-producing animation from ...
2
votes
1
answer
172
views
Tkinter and animation.FuncAnimation accumulating delay and freeze GUI
I am working on a Tkinter project where I am plotting live data from different sensors.
I am using Tkinter to create the GUI and matplotlib animation.FuncAnimation to create live plots that update ...
0
votes
1
answer
140
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
93
views
Updating animation with slider
I'm currently developing an animation featuring a double pendulum, and I'd like to incorporate sliders to enhance user interaction. These sliders are designed to control the two initial angles of the ...
-1
votes
1
answer
91
views
Plotting of the sinosuidal functions according to the pixel in Python
I want to plot two sinusoidal functions. The generation of the plotting should be done according to the pixel size, like pixel by pixel. Any help regarding how to do this? The code I used to generate ...
2
votes
1
answer
301
views
Animating Circles on a Matplotlib Plot for Orbit Simulation in Python
Intro to the task
I am working on a simulating the orbit of moon Phobos around the planet Mars. I have completed the task of using numerical integration to update the velocity and position of both ...
0
votes
2
answers
207
views
How to convert 3D histogram to heatmap
I am wondering if there is a way to map a 3D histogram from matplotlib to a color heatmap?
For example I have a 3D histogram as
How can I convert it to a heatmap where the height is shown as color of ...
0
votes
1
answer
145
views
Matplotlib Animation, Either Runs Slow and Replots Colorbar, or Missing Plot
I am attempting to animate data that I have previously saved by loading the numpy array for each frame.
My code is as follows:
fig, ax = plt.subplots(1, 1, constrained_layout = False)
def routine(...
1
vote
0
answers
52
views
Canvas dont show animation
I need to show live data from serial port into a canvas of PyQt5.
Using PyQt5 and imported Ui file(MainTest_1.ui), Here I should get live data from serial port and after putting a number in the Port ...
2
votes
1
answer
80
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
1
answer
652
views
Animation of fluid flow over a cylinder
I am trying to write a Python code to animate fluid flow over a cylinder. I can plot the streamlines fine but I am trying to draw velocity vectors on the plot. I am having problems with some of the ...