widgetti / ipyvolume

3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
MIT License
1.93k stars 234 forks source link

Style the resulting plot #1

Closed diego898 closed 7 years ago

diego898 commented 7 years ago

Thank you for this great tool

I couldn't find any information in the docs on how to style the plot? I use seaborn, so I'd like this 3D plot to match the rest of my 2D plots generated by seaborn.

maartenbreddels commented 7 years ago

Hi, thanks. No, there isn't anything to configure at the moment. Step 0 would be to make at least colors configurable, background, axis etc. But I'll keep in mind that it may be a good idea to support matplotlib styles.

maartenbreddels commented 7 years ago

It is not in release yet, but styling is possible now.

import ipyvolume.pylab as p3
p3.style.use('dark')

default is the 'light' theme, which has a white background to blend more into the notebook style. There is some code to copy matplotlib style, so you can actually do:

import ipyvolume.pylab as p3
p3.style.use('seaborn-light')

But it's not working really well. And I'm not exactly sure how the theming in matplotlib works, I noticed that the fivethirtyeight theme depends on some other defaults (such as text being black). So in the future we may have to either improve this code, or copy it in ipyvolume style.

If you modify or add a theme (in ipyvolume/style.py, documentation is sparse) and you should run

python -m ipyvolume.style

This will create js/data/style.json, which is required, since in embedded mode, the defaults will not be passed. This will also make is possible to change the theme outside the notebook in the future. screen shot 2017-03-03 at 22 19 23