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
Collaborator

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.

'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

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to remove this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, missed that one. removed in ed65c14

@philippjfr
Copy link
Member

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

@philippjfr
Copy link
Member

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
Collaborator Author

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

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
@jonmmease jonmmease deleted the plotly3 branch November 25, 2018 17:04
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make compatible with plotly 3.0
2 participants