plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.02k stars 2.54k forks source link

Feature: use scalar field for color of go.Scatterternary (or figure factory) #1500

Closed emmanuelle closed 3 months ago

emmanuelle commented 5 years ago

I'm trying to write an example showing how to make a ternary scatter plot, based on Quartz-Clay-Carbonate ternary plots used in the oil and gas industry such as https://bit.ly/2IjtQgL. For such examples, it would be great to have a keyword argument which would be a scalar (such as the index of the oil field for this specific example), and could be used for the color or size of the markers.

I'm not sure whether this could be added to go.Scatterternary, or whether a figure factory should be created instead?

emmanuelle commented 5 years ago

ternary_oil

nicolaskruchten commented 5 years ago

A couple of notes:

emmanuelle commented 5 years ago

Thank you @nicolaskruchten! I finally took the time to take a look at plotly express, and it's amazing! Regarding the docs, should the doc tutorials of plotly.py add links to the doc of plotly express? Is there already a discussion of how to organize the two docs?

jonmmease commented 5 years ago

Regarding the docs, should the doc tutorials of plotly.py add links to the doc of plotly express?

Yes, the current plan is that we're going to pull plotly_express into plotly.py for plotly.py version 4. Version 4 is also going to change the recommend approach to displaying figures (See https://github.com/plotly/plotly.py/pull/1474) so we're going to need to do a full docs overhaul for that. My thinking was that we would bring plotly_express into all of the doc pages at the same time.

nicolaskruchten commented 5 years ago

I'm glad you like it @emmanuelle :D

I'm thinking of adding a note to some of the figure factories in the short run saying "check out Plotly Express", just to start bleeding off some of that traffic and directing more users to PX so we can get some more early adopters.

ycaokris commented 5 years ago

@emmanuelle @nicolaskruchten same type of issue. I've been working on a dash mock with same type of figure as following:

Screen Shot 2019-04-08 at 2 35 50 PM

Except for color traces, what may be worth to add on is annotation implementation with ref to a, b, and c axis, since it seems current scatterternary doesn't support 3D annotation, so that I'd have to do x and y. Let me know if there's a workaround I've missed and look forward to updates on PX

Screen Shot 2019-04-08 at 2 57 26 PM
emmanuelle commented 5 years ago

@ycaokris you can use a Scatterternary with the a, b, c coordinates you need, invisible markers and use the text keyword argument for the annotations, would this work for you?

emmanuelle commented 5 years ago

Also your app looks pretty cool @ycaokris !

ycaokris commented 5 years ago

Also your app looks pretty cool @ycaokris !

Thanks for suggestion, it works! Just adding another layer of scatterternary with mode='text'. The only problem is overlap of three layers (scatter, contour, text) is making the plot fully crowded. I'll probably add a controller for conditional display of annotations

gvwilson commented 3 months ago

Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson