Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix ratio resizing issue #1179
Currently, when you resize a plot that has a ratio in
import vcs, cdms2 datafile = cdms2.open(vcs.prefix + "/sample_data/clt.nc") clt = datafile("clt") x = vcs.init() x.plot(clt, ratio="autot") x.interact()
But hey, let's compare that to another plot that was actually plotted at that window size, for giggles...
# press "Q", resume execution y = vcs.init() # You can plot whatever here, it doesn't matter initially y.plot(clt) # Just needed to get the window open... y.clear() # Resize to the size of x's window y.backend.renWin.SetSize(x.backend.renWin.GetSize()) y.plot(clt, ratio="autot") raw_input("Huh, would you look at that...")
While we can debate whether the labels should run over each other like that, the second behavior is the "correct" behavior, as the resizing in the first window only happens while in interact mode.
This PR should fix this issue– I looked into it, and plots given a ratio actually already generate a new template. My system was snagging that copied template, and then using it as the basis for a new template. This would cause some cascading error in the resizing logic, which is why the resize came out weird. Since the template is already a copy, I can just add the original and the copy into the existing store of templates. As a happy side effect, the code got a lot shorter and less wacky.