Skip to content

enable changing the color of marker icons in a ScatterMapBox plot #6599

Closed

Description

@serboba
<head>
	<!-- Load plotly.js into the DOM -->
	<script src='https://cdn.plot.ly/plotly-2.20.0.min.js'></script>
</head>

<body>
	<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
        <script>
        var data = [
	{
		type: "scattermapbox",
		mode: "markers+text+lines",
		lon: [-75, -80, -50],
		lat: [45, 20, -20],
                color:'red',
		marker: { size: 20, symbol: 'bus' },
		text: 'bus',
		textposition: "bottom right"
	}
];

var layout = {
	mapbox: { style: "outdoors", zoom: 0.7 },
	showlegend: false, height: 500, width: 700
};

var config = {mapboxAccessToken: mytoken};

Plotly.newPlot("myDiv", data, layout, config);

    </script>
</body>

I tried to change the color of the MAKI icons by trying to specify it inside marker dict but it does not work. However, changing the style of mapbox in the layout changes the color of the icons. So it should be possible to specify the color in the marker too (without changing the style). I could not find any information about this in the documentation.

Many thanks in advance.

Activity

  1. Kully commented on May 22, 2023

    @Kully
    Contributor

    I could not find any information about this in the documentation.

    See here:

    https://plotly.com/python/reference/scattermapbox/#scattermapbox-marker-symbol

    image
  2. serboba commented on Jul 18, 2023

    @serboba
    Author

    Yes, but this works only if the marker symbol is not a MAKI icon.

  3. self-assigned this
    on Jul 5, 2024
  4. removed their assignment
    on Aug 2, 2024
  5. changed the title [-]Changing the color of marker icons in a ScatterMapBox plot[/-] [+]enable changing the color of marker icons in a ScatterMapBox plot[/+] on Aug 9, 2024
  6. emilykl commented on Aug 28, 2026

    @emilykl
    Contributor

    Fixed by #7825.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions