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
Matplotlib doesn't save correctly the figuren when using patches.Circle on different plots #1148
Comments
It would really have helped if you could have provided a SSCCE. In this case, I think you are using the same collection on more than one axes instance which is not supported in matplotlib. |
@pelson I provided code and data files in the tarball to reproduce the issue. I did not have time to make a smaller self contained example, nor to investigate the issue in depth. The fact that a collection can one be used on one axes instance doesn't seem to be mentioned in the documentation nor in the docstring (I can't find it at least). If not supported, it should IMO at least be mentioned in the docstring. I personnally think that this is a bug. It is not clear why, from a user point of view, we would not be able to reuse such an object. |
Every artist is attached to a single axes. This is part and parcel how the If this isn't in the Artist documentation, then it probably could be a bit |
I agree. How about the following to reproduce:
(you get some nasty clipping of the circle in figure 1 as a result of the underlying collection's transform being implicitly bound to axes 2. Workaround: Make two collections from the same set of patches:
I cannot see that "fixing" this is possible, but I do agree that there is a documentation issue here. |
my bug is not exactly that. When running it in ipython (or python), it displays the plots properly. It just doesn't save them properly. Also the figures are of the same size and shape. I'll checkout how to do a smaller script to reproduce the bug if I have time tomorrow. |
Does the workaround solve the issue for you though? That would be the give-away if it does. |
@pelson recreating everything works, indeed. |
Here's a new gist with the bug report: https://gist.github.com/3491953 |
I agree what is rendered is not what is drawn. This is fairly clearly related to the fact that the collection is being used in two different axes (and therefore the collection's transform is only representative of one of the figure's "device" coordinates). I can't pinpoint what exactly is causing the funny rendering in one case and not the other, but as I said, my feeling is that this is a documentation issue and it cannot be resolved fully without a major re-work. Since this falls slightly under the transform radar (one artist can only have one full stack transform) I would be interested to hear what @mdboom has to say. Thanks for reporting this @NelleV and spending the time getting a SSCCE together. |
Closing this because as @WeatherGod says, artists can only be in one axes. |
Matplotlib doesn't save the figure as it shows it: the third figure's circle is not rendered the same way (different size and center) than the one displayed with plt.show()
The code to reproduce the bug can be found here:
https://gist.github.com/3488488
The data files (numpy arrays) to reproduce the code can be found here: http://cbio.ensmp.fr/~nvaroquaux/matplotlib_bg.tar
I am using matplotlib version 1.1.0, with python2.7
The text was updated successfully, but these errors were encountered: