I want to give you +1, but my reputation still does not allow it. Thank you very much for the code, I managed to place the imported image in the artist you are using by changing this line:
bbox_image.set_data(mpimg.imread("C:\\image.png"))
note I added this too
Import matplotlib.image as mpimg
But something else fails when I try to use funcanimation for animation, I get an error message, here is my code (yours changed):
import matplotlib.pyplot as plt import numpy as np from matplotlib.image import BboxImage from matplotlib.transforms import Bbox, TransformedBbox import matplotlib.image as mpimg from matplotlib import animation
This tells me Error: the "BboxImage" object is not iterable I assume that only part of the position of this BboxImage should be returned I used to do this with Line2D objects, adding to whom, for example: return lineobject, this means that only the first element of the tuple will be returned but I donβt see how this can be done using BboxImage
Actually, I can just use the loop, as you did, but maybe you know how to adapt it to function?
Edit:
I changed your code again using the bbox method:
for j in range(5000): x = 2*np.sin(np.radians(j)) y = 2*np.cos(np.radians(j))
I can then convert this to use the functionalization as follows:
def animate(i): x = 2*np.sin(np.radians(i)) y = 2*np.cos(np.radians(i))
This gives me an error: the 'list' object does not have the 'axes' attributes, this is the return that I do in the animate function, the return value must be converted somehow, I think ... Do you know how I can do this? Thanks