-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixed large pcolormesh rendering with bbox_inches='tight'. #4045
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
Conversation
This does not account for having a non-trivial |
Can you provide a simple example? I've never properly understood the offsets in some collection contexts. |
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
X, Y = np.meshgrid(range(25), range(20))
C = np.random.rand(*X.shape)
offsets = (np.random.randn(2, 24*19)
ax.pcolormesh(X, Y, C, offsets=offsets, transOffset=ax.transData) which has an odd extra shift from (0, 0) to (3, 2.3) for the lower left. I am also not really clear on why this is useful, but it is something that the code does. |
The code for this in agg ends up in c++ layer and gets really hairy really fast. |
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
X, Y = np.meshgrid(range(25), range(20))
C = np.random.rand(*X.shape)
offsets = np.random.randn(24*19, 2) * .1
ax.pcolormesh(X, Y, C)#, offsets=offsets, transOffset=ax.transData)
fig.savefig('so.png', bbox_inches='tight') gives me
|
Note, for smarter transforms including caching (a common | ||
requirement for matplotlib figures), see :class:`TransformedBbox`. | ||
""" | ||
return Bbox(self._transform.transform(bbox.get_points())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line should be return Bbox(self..transform(bbox.get_points()))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
Thanks for the example @tacaswell. I did not know you could do that! |
I concur about the trade off. |
BUG : Fix run-away memory usage with pcolormesh + bbox_inches='tight'
Replaces #4017.
Closes #3095.