Multiple Colors Based on Airline in US Flight Maps Gallery Example

Hello All,

New to plotly, and I have a question. For the gallery example US Flight Paths map found here the source data also captures the airline the flight was on.

My question is this: What would be the easiest way to differentiate the line colors based on who the airline was? That way we could see not only overall traffic, but which airlines were flying which routes.

Apologies if this is very basic, Iโ€™ve only picked up plotly in the past week or so.

Hi @jkhellman, welcome to the plotly world :slightly_smiling_face:

In this example, every line is itโ€™s own trace object so you can set the color of each line individually using the line.color property of the scattergeo traces. The example sets them all to 'red'. So you could create a mapping from airline to color and replace 'red' with those colors.


Hello @jmmease that makes a lot of sense, thank you! And I appreciate the welcome :slight_smile: