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

new_plot() should not mutate existing EasyPlot instance. Instead, create duplicate EasyPlot object #4

Open
HamsterHuey opened this issue May 31, 2014 · 0 comments
Assignees

Comments

@HamsterHuey
Copy link
Owner

In EasyPlot 1.0.0, the new_plot() instance method mutates the EasyPlot instance on which it is called to create a new plot while retaining plot parameters that were previously set on the EasyPlot instance.

This behavior is not ideal as it forces the user to give up access to an existing EasyPlot object/figure in order to reuse it as a template for another plot. The correct behavior would be for new_plot() to return a new EasyPlot instance that is a duplicate of the EasyPlot instance on which new_plot() is being called. See the code snippet below as an example:

eplot = EasyPlot(x, y, showlegend=True, xlabel='x', ylabel='y',
                 label='plot 1', grid='on')
# Create new EasyPlot object that uses eplot as template
eplot2 = eplot.new_plot(x2, y2) 
# User can choose to overwrite existing EasyPlot instance
eplot = eplot.new_plot(x3,y3) 

This WILL BREAK backwards compatibility
Alternate option would be to introduce a new instance method, eg: copy_plot() that produces the behavior mentioned above while retaining the current behaviour of the new_plot() method.

@HamsterHuey HamsterHuey self-assigned this May 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant