plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.06k stars 1.87k forks source link

[Feature Request] Support line styles in Scattermapbox #6791

Open Worschi opened 11 months ago

Worschi commented 11 months ago

It would be nice to plot lines of different styles, e.g. dashed, dotted, etc. to a Scattermapbox layer. The lack for this feature has been noted here How do I change the line style to dash in a scattermapbox plot?, and here How to change line shape in mapbox maps?

Currently (Plotly 5.18), the only supported line attributes are "color" and "width" . However, distinguishing lines by color is not sufficient for monochrome styled figures. In addition, certain line styles are frequently expected:

Coding-with-Adam commented 11 months ago

Good idea, @Worschi. Would you be interested in seeing if you can find this functionality in Mapbox itself and figure out how the API compares with what we have for line dash and scatter traces?

Worschi commented 11 months ago

Hello @Coding-with-Adam, thanks for noticing! I'd probably be able to do some more research and post my findings here. I already came accross a working code snippet for "line-dasharray" styled lines in the mapbox-gl.js class.

Have a look at this minimal jsfiddle example. It uses a "line-dasharray" in the mapbox-gl.js to plot dashed lines. There may be better ways though since my initial reseach was not thorough.

Would you be so nice as to point me in the right direction for plotly API to mabox API mapping?

archmoj commented 11 months ago

Please see this mock: https://raw.githubusercontent.com/plotly/plotly.js/master/test/image/mocks/mapbox_geojson-attributes.json which renders as https://raw.githubusercontent.com/plotly/plotly.js/master/test/image/baselines/mapbox_geojson-attributes.png

Worschi commented 11 months ago

Nice! Thanks, @archmoj. I'll try this out beginning of the week and let you know if it worked for my use case. I'll keep you posted and close this issue in case it did.

Worschi commented 11 months ago

Hello, the dashed line style does indeed work in geojson layers. I set up a minimal working example to demonstrate: dashed line in mapbox layer example

I am confident, that I can tweak my code to use geojson lines instead of Scattermapbox traces. I'll go ahead an close this issue now. Although I wonder if the documentation should improve in this regard? Several people looked for this on the internet and could not find solutions. Anyhow, thanks again @archmoj for pointing this out! I'd not have found this in the docs quickly.

alexcjohnson commented 11 months ago

Thanks @Worschi! Good to know that this can be done with a geojson layer. But I'd like to keep this issue open until we investigate adding it to scattermapbox, that will still be more useful if we can get it working.

Worschi commented 11 months ago

Hi @alexcjohnson, fine with me. I am not sure when/if I'll be able to investigate further. The team already moved on and, for now, settled with not having dashed lines.

kussshhhh commented 6 months ago

@alexcjohnson is this issue still open?

Coding-with-Adam commented 6 months ago

hi @kussshhhh Yes, this issue is still open

Ayfri commented 4 months ago

Any update ?

salignatmoandal commented 3 months ago

is this issue still open?

gvwilson commented 3 months ago

yes, but I don't know when someone will be able to work on it - we have a very large backlog that we're trying to clear