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

Update plotly backend to support plotly.py version 3 #3194

Merged
merged 15 commits into from Nov 25, 2018

Conversation

@jonmmease
Copy link
Member

@jonmmease jonmmease commented Nov 24, 2018

This PR updates the plotly backend to be compatible with (and require) plotly.py version 3.4+. This closes #2864.

I left a detailed commit trail explaining the updates, but let me know if you have any questions! For more background, see the plotly.py version 3 migration guide.

jonmmease added 14 commits Nov 24, 2018
's' is not a valid plotly symbol string, use 'circle' instead
'plasma' is not a valid plotly colorscale, use 'viridis' instead
The global plotly library object was renamed from 'Plotly' to '_Plotly'
in plotly.py 3.4.0 to avoid a naming conflict when a Jupyter Notebook
heading contained the text 'Plotly'

See:
plotly/plotly.py#816
plotly/plotly.py#1250
Graph objects are now structured hierarchically, so go.Marker was
deprecated in favor of go.layout.Marker.  The use of these classes
is fully optional, and they can be replaced by plain dict instances in
cases where local validation, tab completions, and docstrings aren't
needed.
cannot be mutated in place. Instead, the add_traces method is used
to append additional traces to the figure.
rather than lists so they cannot be extended in place.
The += operator can be used instead to replace the object array with
an extended version of itself.
dict instances with some dict-like methods. The to_plotly_json method
is used to convert a graph object into a Python dict.
but when loaded into the notebook it is loaded as _Plotly.

(before this commit figures rendered properly in the jupyter notebook
but an error was raised when output to an HTML file that _Plotly is
not defined)
… timeout.

See https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received

Prior intermittent CI error:
```
...
$ conda env update -n holoviews -q -f environment.yml
Solving environment: ...working... done
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... dbus post-link :: /etc/machine-id not found ..
dbus post-link :: .. using /proc/sys/kernel/random/boot_id
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
```
@philippjfr
Copy link
Member

@philippjfr philippjfr commented Nov 25, 2018

This is brilliant @jonmmease, I really, really appreciate it. I was going to work on this pretty much starting tomorrow in anticipation of releasing next week.

figure['data'].extend(fig['data'])

figure.add_traces(fig.data)
print(type(self), self.projection)

This comment has been minimized.

@philippjfr

philippjfr Nov 25, 2018
Member

Would be good to remove this.

This comment has been minimized.

@jonmmease

jonmmease Nov 25, 2018
Author Member

Whoops, missed that one. removed in ed65c14

@philippjfr
Copy link
Member

@philippjfr philippjfr commented Nov 25, 2018

Left one minor comment but once that's resolved I'd be happy to merge this.

@philippjfr
Copy link
Member

@philippjfr philippjfr commented Nov 25, 2018

One quick unrelated question, I just merged a PR which let's users map columns in their data directly onto the style attributes of the artist/glyph, but haven't ported this feature to plotly yet. How flexible is plotly with setting vectorized properties, e.g. to control the alpha/linewidth/color per point/simplex/line segment etc.?

@jonmmease
Copy link
Member Author

@jonmmease jonmmease commented Nov 25, 2018

Most of the properties of scatter.marker and bar.marker can be specified as vectors. Off the top of my head, scatter (2D, 2D WebGL, and 3D) supports vectorized color, opacity, size, and symbol and bar supports vectorized height (of course 🙂), baseline, bar width, line width, opacity, bar color, and outline color,

plotly.js doesn't really support vectorizing line properties at this point, i.e. you can't currently vary the color or width of a line within the line.

Also, I'd like to write out a summary of the areas where I think the plotly renderer could be enhanced by taking advantage of existing plotly.py/plotly.js features. If this is agreeable on your end, would you prefer one large master issue or a bunch of smaller issues (maybe with a plotly label)?

@philippjfr
Copy link
Member

@philippjfr philippjfr commented Nov 25, 2018

Most of the properties of scatter.marker and bar.marker can be specified as vectors.

Thanks, that's really helpful.

plotly.js doesn't really support vectorizing line properties at this point, i.e. you can't currently vary the color or width of a line within the line.

Not really surprising, neither does bokeh or matplotlib.

Also, I'd like to write out a summary of the areas where I think the plotly renderer could be enhanced by taking advantage of existing plotly.py/plotly.js features.

That list of probably very long, the plotly renderer exists mostly as a proof of concept and as quick release valve for us to support interactive 3D plots. Let's start by putting that in one issue and then we can break that up into smaller sub-issues.

Once again I'm really impressed by your work on plotly, and really appreciate you taking the time to update this code. I'll merge now to get the basics working again.

@philippjfr philippjfr merged commit 80a037a into holoviz:master Nov 25, 2018
3 checks passed
3 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.3%) to 89.4%
Details
@philippjfr
s3-reference-data-cache Test data is cached.
Details
@jonmmease jonmmease deleted the jonmmease:plotly3 branch Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants