Skip to content

saving layouts #69

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

Closed
arsenovic opened this issue Jul 14, 2014 · 3 comments
Closed

saving layouts #69

arsenovic opened this issue Jul 14, 2014 · 3 comments

Comments

@arsenovic
Copy link
Contributor

is there any infrastructure to save and re-use layouts? couple things that would be nice

  • change my default layout

  • pass layout as argument to mpl_to_plotly, iplot_mpl, plot_mpl

  • have style files (like matplotlib.style)

    from plotly import style
    with style.context('ieeetrans'):
    py.iplot(....)

@theengineear
Copy link
Contributor

This is definitely something that's on our radar. Currently, the 'iplot_mpl' and 'plot_mpl' both have support for 'updating' with whatever options you want. For instance, this might work for you:

# save the layout you want to use later
import json
my_layout = {'title': 'the title i always use'}
with open('my_layout.json', 'w') as f:
    json.dump(my_layout, f)

Now, if you want to use that again...

import matplotlib
import plotly.plotly as py
import json
# make an mpl figure
## do mpl stuff -> get your 'mpl_fig' variable

# load up that layout
with open('my_layout.json') as f:
    my_layout = json.load(f)

# use that to update mpl
py.iplot_mpl(mpl_fig, update={'layout':my_layout})

note that the value for the keyword 'update' must be a valid figure object in plotly

Not saying this is perfect, but I don't think we know what is quite yet. So until then, this is still in discussion mode.

Therefore, I think you already have access to do point (2), but your points (1) and (3) are still up in the air on our end.

This is great feedback, we'll definitely keep this dialogue open as this gets sorted out.

@arsenovic
Copy link
Contributor Author

great! that addresses (2) perfectly. i must have missed the update option from the users guide.

here is a link to matplotlib style sheets, fyi,
https://github.com/matplotlib/matplotlib/blob/master/doc/users/style_sheets.rst
it would also be cool for plotly to [eventually] provide a set of styles, like ggplot, nyt, printable, journal, etc. i hate seeing time wasted on redundant styling.

by the way, the users guide has helped me enormously. i find the narrative-style docs are much easier to follow than the API-web style. and i love the way plotly is moving. the get_figure() provides a great cross-over workflow.

@theengineear
Copy link
Contributor

Awesome. This is great to hear! The team, i.e., @etpinard, has been putting a ton of effort into the user guides.

I've checked out the matplotlib styles. Setting defaults and overwriting them is definitely a valid solution to this problem. I think that matplotlib 1.4.x is supposed to push the style features even further.

We're still trying to figure out the best way to do something like get_style(get_figure("")) so that we see folks grabbing other's styles easily without the original user needing to put in too much effort into making some sort of default style...

I'm going to close this, but reopen it or open a new issue if there's something else to add.

Again, thanks for the feedback!

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

No branches or pull requests

2 participants