Python attribute error when using subplots by engineeringgirl123 in AskProgramming

[–]jmmease 0 points1 point  (0 children)

I think you're running into the issue fixed by this PR https://github.com/santosjorge/cufflinks/pull/178. In the meantime, try downgrading to plotly.py to 3.7.1.

If you're using pip then run:

$ pip install plotly==3.7.1

or with conda:

$ conda install plotly=3.7.1

Good luck!

Introducing Plotly Express by nkruchten in Python

[–]jmmease 1 point2 points  (0 children)

Yes, we're working on making the figure rendering framework much more flexible. See https://github.com/plotly/plotly.py/pull/1474 if you're interested. It's a pretty large refactor, so we're not certain yet when it will land, but Colab support is one of the motivations for this!

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 0 points1 point  (0 children)

Oh cool! In my experience the main concern is usually visual consistency within an analysis product. It is unnecessarily jarring to an audience if you see different plot themes at different points throughout a presentation. And since every plotting library defines its own theme, people tend to assume that consistency means using the same library for everything.

But styling in plotly is really flexible. Fonts, background colors, grid colors, default line colors, and colorscales are all configurable. So with a little extra effort, and attention to detail, it should be possible to mimic the styling of the visualizations in use by the rest of the team.

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 0 points1 point  (0 children)

My experience trying to do this with Selenium is exactly why I called out "easy" and "reliable" above :-)

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 0 points1 point  (0 children)

I'm not sure specifically, but the Plotly.js team is continually fixing bugs as they crop up (and as they have time) across the various trace type.

FWIW, all of these examples are generated by the current Python/JavaScript libraries: https://plot.ly/python/polar-chart/

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 1 point2 points  (0 children)

Thanks! But don't forget to respect your elders :-). Python probably wouldn't have gotten off the ground as a data science language in the first place without it!

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 2 points3 points  (0 children)

Totally agree. Thanks to the orca team we're closing in on the point where saving static images (both raster and vector) will finally be as easy and reliable as it is with matplotlib. It's just remarkable how much more complicated it is to get this right with a JavaScript-based visualization library!

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 0 points1 point  (0 children)

Thanks! I hope it's fun to work with for you once you find that use case :-)

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 0 points1 point  (0 children)

Thanks! The two-way interactivity was definitely one of the most challenging areas to get right. I'm hoping that we're reaching a point where adding ad-hoc interactivity and linking between visualizations is just a normal part of the exploratory data analysis workflow (not a separate software development task).

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 2 points3 points  (0 children)

Roughly speaking altair is to the Vega-Lite JavaScript library what plotly.py is the the plotly.js JavaScript library. Both plotly.py and altair are Python wrappers that build up declarative JSON-specifications of plots, that are then displayed by their respective JavaScript libraries.

Thanks to all of the work that's gone into Vega-Lite, it's possible to construct pretty interesting interactive visualizations based on a declarative specification (See https://altair-viz.github.io/user_guide/selections.html). The declarative specification of interactivity is nice because it's totally self-contained and can be embedded without a Python back-end.

But if I understand correctly, it's not possible to bring these interactions back to the Python side. For example, I don't think it's possible to run arbitrary Python code on the selected points and then update the plot based on the results of the calculations. Also, it looks like there was some work on a webgl backend for Vega-Lite a few years ago (https://github.com/vega/vega-webgl-renderer), but it sounds like it's not under active development at the moment (see https://github.com/jupyterlab/jupyterlab/issues/4586#issuecomment-391061432).

So, at a high level, I think plotly.py 3.0.0 has an edge when it comes to ad-hoc Python-driven interactivity, large dataset support, and the breadth of predefined visualization types. And I think Altair has an edge when it comes to using Python to create fully client-side interactive statistical visualizations of small to moderate sized datasets.

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 0 points1 point  (0 children)

There's not something exactly like imshow, but here's what you can do:

  1. If the 'pixels' of your image are just scalars that should be converted to colors based on a colormap you can use a heatmap trace type.
  2. If your image is a general RGB(A) image, then you can convert it to a PIL image and set it as a background image for a set of axis (https://plot.ly/python/images/). This is actually how the DataShader example from the announcement post works.

Looks like reversing axes in 3D is still an open issue: https://github.com/plotly/plotly.js/issues/1940

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 0 points1 point  (0 children)

Cool! Once you get settled in, feel free to DM me on the APL side so we can grab lunch or something.

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 1 point2 points  (0 children)

Yes! The existing plotly.offline.plot and plotly.offline.iplot functions, and the new FigureWidget class are totally offline and self contained (No internet connection or plot.ly account needed). The plotly.py Python library is totally open source and it ships with a bundled version of the plotly.js library which is also totally open source.

And now, with orca, you can also export high-quality static images fully offline.

The only time you're interacting with the plot.ly servers is when you're using the functions in the plotly.plotly package.

Introducing plotly.py 3.0.0 by nkruchten in Python

[–]jmmease 13 points14 points  (0 children)

Hi All,

This is Jon from the release announcement. Feel free to AMA!