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

Plot creates new graphics method objects #268

Closed
danlipsa opened this issue Nov 8, 2017 · 7 comments
Closed

Plot creates new graphics method objects #268

danlipsa opened this issue Nov 8, 2017 · 7 comments
Labels

Comments

@danlipsa
Copy link
Contributor

danlipsa commented Nov 8, 2017

Plotting a boxfill with a given graphics method still creates a new graphics method. Why?

Also, when we do not pass our own graphics method, a new gm is created, but we don't know its name so that we can delete it. We should provide a why to access the name of the gm created so that we can deleted after we plot.

@doutriaux1 Do you remember the reason why graphics methods are created in the plot function? We seem to look at the data and modify gm parameters based on that. Is that the motivation behind this? Why not changing the gm that is passed as a parameter than?

>>> import vcs
>>> import cdms2
>>> vcs.download_sample_data_files()
>>> f=cdms2.open(vcs.sample_data+"/clt.nc")
>>> s=f("clt")
>>> x=vcs.init()
>>> gm = vcs.createboxfill('myboxfill')
>>> vcs.elements['boxfill'].keys()
['polar', 'a_lambert_boxfill', 'default', 'a_boxfill', 'a_polar_boxfill', 'a_robinson_boxfill', 'a_mollweide_boxfill', 'myboxfill', 'quick', 'robinson']
>>> x.plot(s, gm)

>>> vcs.elements['boxfill'].keys()
['polar', 'a_lambert_boxfill', 'default', 'a_boxfill', 'a_polar_boxfill', '__boxfill_511997554805793', 'a_robinson_boxfill', 'a_mollweide_boxfill', 'myboxfill', 'quick', 'robinson']
@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 8, 2017

@aashish24 Any comments on this?

@doutriaux1
Copy link
Contributor

doutriaux1 commented Nov 8, 2017

@danlipsa we make copy of the gm for MANY reasons such as changing labels, title, etc... changing default levels, sometime we also create new templates, for aspect ratios etc... But I thought they were cleaned up automatically once the canvas is cleared.

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 8, 2017

@doutriaux1 If that's the case, it is fine even if a little disconcerting to new users such as myself. 😄

@doutriaux1
Copy link
Contributor

doutriaux1 commented Nov 8, 2017

@danlipsa can you double check it goes away after a clear? Do you think we should add a special "tag" in the name so that we do not list "nuder the hood autogenerated" objects in the list functions?

@doutriaux1
Copy link
Contributor

doutriaux1 commented Nov 8, 2017

also you should use vcs.listelements("boxfill") not vcs.elements["boxfill"].keys() because the last one is the developer hook and could change in the future whereas the first one is the official API call

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 8, 2017

Yes, it does go away when you call clear. I do think we should add a special tag and not list those graphics methods as the user has no idea what they are and who created them. In my mind, they should be deleted after plot finishes as they are never used again. But its a low priority task as long as we delete everything on clear. Thanks for the listelements tip.

@danlipsa
Copy link
Contributor Author

danlipsa commented Nov 13, 2017

This might come up for vcdat as users might browse through all graphics methods and might be confused by these temporary gm-s. We'll see ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants