Skip to content
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

Fix ratio resizing issue #1179

merged 1 commit into from Mar 30, 2015


Copy link

@chaosphere2112 chaosphere2112 commented Mar 27, 2015

Currently, when you resize a plot that has a ratio in interact() mode, things go badly.

import vcs, cdms2
datafile = + "/sample_data/")
clt = datafile("clt")

x = vcs.init()
x.plot(clt, ratio="autot")

Here's how the plot looks when you first make it (Perfectly correct)
screen shot 2015-03-27 at 11 57 35 am

Here's how it looks when you shrink the window (Not too bad...)
screen shot 2015-03-27 at 11 57 50 am

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
# Just needed to get the window open...
# Resize to the size of x's window
y.plot(clt, ratio="autot")
raw_input("Huh, would you look at that...")

Here's the x canvas' plot:
screen shot 2015-03-27 at 11 57 50 am

Here's the y canvas' plot:
screen shot 2015-03-27 at 11 58 00 am

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.

@doutriaux1 @aashish24 Mind taking a look?

Copy link

@aashish24 aashish24 commented Mar 27, 2015

LGTM but I will wait for @doutriaux1 to review since I am not sure if this could open some other issues.

Copy link
Contributor Author

@chaosphere2112 chaosphere2112 commented Mar 27, 2015

Copy link

@doutriaux1 doutriaux1 commented Mar 30, 2015

LGTM as well, it's much cleaner like this too!

doutriaux1 added a commit that referenced this issue Mar 30, 2015
@doutriaux1 doutriaux1 merged commit c8ff7e6 into CDAT:master Mar 30, 2015
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants