After talking to Sam and Devin at PiTP and then to Dave yesterday (at UCSD, my new residence) it's become clear to me that the PlotTypes and PlotCollections files -- which are remarkably unchanged over the last 2+ years of development, since they were first implemented -- have become a bit stale and have some creeping bugs. People have worked around them, but it's time for an overhaul.
I'm writing with a new plan for how to handle plots, and I'm writing because it might affect some of you. The basic idea is that plots will have valid and invalid states; invalid plots will be redrawn as necessary. Additionally, Pixelization into buffers will occur only inside FixedResolutionBuffers, and every plot will have an associated FRB.
So, a plot starts out, and it sets itself up and marks itself and its colorbar as invalid. We then save it, and it sees that it's invalid, so it redraws. This marks the colorbar as invalid (even though it already is), and then the colorbar gets redrawn. Both are now valid. We then change the zlim, which marks the colorbar as invalid while the image remains valid. (Colorbar and colormap are essentially inextricable here.)
So far, I think it's fine -- but the question comes in during user intervention.
So we have a valid state for our plot. (The user can then mess with it however they like, and on the next save, that messing with it will still be there -- because it won't be marked as invalid -- which is a huge advantage!) When we change the width of the plot, then the image becomes invalid. But my real question is, what do we do if the user then sets the zlim and then changes the width?
Set zlim: invalidate colorbar Save: revalidate both Set width: invalidate image
But, what happens to the colorbar? Do we invalidate it, and then reset it on next save? That is, when we change the width, does that override the user setting the colorbar?
Does anyone have any thoughts? Thanks!