-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
'QuadContourSet' object has no attribute 'set_visible' or 'set_animated' #6139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Because (surprisingly) I am 👎 on including this type of fix upstream, this should probably be fixed by promoting A simpler fix for your case would be from matplotlib import animation
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
# Some 2D geo arrays to plot (time,lat,lon)
data = np.random.random_sample((20,90,360))
lat = np.arange(len(data[0,:,0]))
lon = np.arange(len(data[0,0,:]))
lons,lats = np.meshgrid(lon,lat)
mode = 'imshow'
# ims is a list of lists, each row is a list of artists to draw in the
# current frame; here we are animating three artists, the contour and 2
# annotatons (title), in each frame
ims = []
for i in range(len(data[:,0,0])):
if mode == 'contour':
im = ax.contourf(lons,lats,data[i,:,:])
add_arts = im.collections
elif mode == 'imshow':
im = ax.imshow(data[i, :, :], extent=[np.min(lons), np.max(lons),
np.min(lats), np.max(lats)],
aspect='auto')
add_arts = [im, ]
text = 'title={0!r}'.format(i)
te = ax.text(90, 90, text)
an = ax.annotate(text, xy=(0.45, 1.05), xycoords='axes fraction')
ims.append(add_arts + [te,an])
#ani = animation.ArtistAnimation(fig, ims, interval=70,repeat_delay=1000, blit=False)
ani = animation.ArtistAnimation(fig, ims)
## For saving the animation we need ffmpeg binary:
#FFwriter = animation.FFMpegWriter()
#ani.save('basic_animation.mp4', writer = FFwriter)
plt.show() |
Could you check to see if just simply passing "corner_mask='legacy'" to the On Thu, Mar 10, 2016 at 8:37 AM, Thomas A Caswell notifications@github.com
|
@WeatherGod "corner_mask='legacy' did not work. It also gave me a warning to use corner_mask=False or True instead. @tacaswell thanks for your improvement. The imshow method does not seem to work, however, if I want to use Basemap (hence the lat and lon variables ;-) ). I guess I then just use m.contourf instead of ax.contourf:
|
@fabrivelas, yeah, the warning message is because the "legacy" mode is On Thu, Mar 10, 2016 at 10:01 AM, fabrivelas notifications@github.com
|
@WeatherGod The change is that with the auto-draw changes animation became much stricter about making sure it's artists were actually in 'animated' mode. In 1.3.1 the OP only had to monkey-patch In either case, it was abuse of the |
…s is not possible due to some internal reason. See here (https://stackoverflow.com/questions/23070305/how-can-i-make-an-animation-with-contourf) and here (matplotlib/matplotlib#6139) for more specific information.
Just want to add that this issue breaks using interactive functions to place clabels as shown in this matplotlib.org tutorial: https://matplotlib.org/stable/gallery/event_handling/ginput_manual_clabel_sgskip.html |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
This was fixed by #25247 turning |
For reference the code from the original message from 2016 above has been working when using the workaround by adding the artists suggested by @tacaswell
|
matplotlib/1.5.1
python3/3.5.1
osx 10.11.3
Installation using homebrew.
The following code gives me an error 'QuadContourSet' object has no attribute 'set_visible'
I added a workaround (http://stackoverflow.com/questions/23070305/how-can-i-make-an-animation-with-contourf) and it worked for version 1.3.1 of matplotlib but with matplotlib version 1.5.1 I get the error 'QuadContourSet' object has no attribute 'set_animated'. Adding extra code similar to that for 'set_visible' makes the code work again.
I would expect the code to work without the Bug fix code snippets included.
The text was updated successfully, but these errors were encountered: