Questions tagged [matplotlib-animation]

This tag is for questions related to the matplotlib animation API

matplotlib.animation API

383 questions
0
votes
0 answers

Live variable to live animated graph - Python

I am new to python and am currently working with Variables, APis and visualisation. Currently I am pulling some sensor data from a API in the form of a temperature for a room. I want to be able to visualise the data that is being pulled, as well as…
HWJ5
  • 17
  • 5
0
votes
1 answer

How to show only 'x' amount of values on a graph in python

I am new to python and am carrying out some little projects along side watching tutorials to enable me to learn. I have recently been working with some APIs to collect data - I save this data in a CSV file and then open the CSV file to show the data…
0
votes
1 answer

Error while updating a plot + How to improve its appearance

I have this code: import matplotlib.pyplot as plt import numpy as np dat=[0,40] fig = plt.figure() ax = fig.add_subplot(111) ax2 = fig.add_subplot(211) Ln, = ax.plot(dat) Ln2, = ax2.plot(dat) plt.ion() plt.show() x, xx = [], [] for i in…
Omar
  • 1,029
  • 2
  • 13
  • 33
0
votes
1 answer

Serial visualisation with MatPlotLib animate not updating properly

I want to visualise values from a pressure sensing mat (32x32 pressure point) in realtime as a heatmap with MatPlotLib animation. The mat outputs 1025 bytes (1024 values + 'end byte' which is always 255). I print these out from inside the animate…
0
votes
1 answer

Append data with different colour in matplotlib in real time

I'm updating dynamically a plot in a loop: dat=[0, max(X[:, 0])] fig = plt.figure() ax = fig.add_subplot(111) Ln, = ax.plot(dat) Ln2, = ax.plot(dat) plt.ion() plt.show() for i in range(1, 40): ax.set_xlim(int(len(X[:i])*0.8),…
Omar
  • 1,029
  • 2
  • 13
  • 33
0
votes
0 answers

Plotting a list of arrays as an animation (against a fixed x axis) in python?

I have a dataset that is of shape (n, x, 2). The length of x is fixed, such as 5. So for each n, I have an array of size (x, 2). For each n, I want to plot the first column of (x, 2) against x as an animation. I've tried doing this: def…
0
votes
0 answers

How to animate array with matplotlib imshow?

I have several image numpy arrays in one array (Number of arrays is dynamic) . I want to show them in a loop and in the same window like animation but infinitely . However, I want to use plt.imshow() for this.
0
votes
1 answer

I want to have a trail in the planet animation

I have been working on a 2 body problem which involves animation of a planet around a star. I want my planet to leave a little trail behind while moving something like this. My code plots everything perfectly except this one thing. I am not able to…
0
votes
0 answers

The python simulation is not smooth and also it takes a lot of time to produce output

Currently I am working on 2 body problem which involves the motion of planet around the sun. In order to do so, in order to do animation I've used FuncAnimation of matplotlib.animation. In this code x_graph and y_graph contains the values for the…
0
votes
1 answer

Matplotlib reverse animation

When using animation.FuncAnimation, is it possible to optimally reverse an animation after it plays in forward? i.e. equivalent of FuncAnimation(.., frames=np.hstack([range(10), range(9)[::-1]])) This redraws frames in reverse order, eating up…
OverLordGoldDragon
  • 1
  • 9
  • 53
  • 101
0
votes
1 answer

Matplotlib animate showing up empty plot even while using a basic tutorials

I used the exact code from this StackOverflow question. When I run this code, this is all I see: I wish I had more details to provide but I'm confused as to why even this simple example is not showing up correctly.
Madhav Thaker
  • 360
  • 2
  • 12
0
votes
1 answer

Matplotlib line chart animation

I am trying to animate a simple line chart with 2 equal arrays. I've seen some guides online but honestly, I'm not sure what I'm doing here, am I close to the solution? I'm looking for this:…
user11910733
0
votes
0 answers

Animating plots for multi object motion - python

I am trying to plot an animation of the motion of several different ships in a North-East frame. Each ship is identified by a circle marker, color, and an ID. The vessel information is stored in a list of Vessel objects each with a positions…
Morten Nissov
  • 392
  • 3
  • 13
0
votes
0 answers

matplotlib - why blitting freezes figure

I have been searching stackoverflow for a solution to the issue of an interactive mpl figure when streaming data to it. I've gotten close with the below example, but when I plot this no matter what mods I make to the code I'm unable to interact…
0
votes
1 answer

Show only one frame at a time using matplotlib.animation.FuncAnimation

I've got some code similar to this from matplotlib import animation import matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots() def animate(i): x0,y0 = np.random.random(size=(2,))*4-2 x = np.random.normal(loc=x0,…
Ethan
  • 534
  • 5
  • 21