How to make a line dashed based on a value from another column.

Hello,

I am plotting some football data. The graph shows results per matchday for one team using vertical lines and the length of the line represents the change in league position. I used p.multiline to plot each line. I am trying to make lines dashed if the team played away and normal if the team played at home. I have a separate column called “Game” which indicates whether the game was played home or away.

Ideally I would want to make the line dashed if the value on the “Game” column is equal to “Away”. I thought about using Boolean indexing on my dataframe columns in order to select only the away games and then plot them separately but that would make my columns in my ColumnDataSource unequal in length as I am plotting circles on the graph as well.

Are there any suggestions on how to make the lines dashed?

Thank you,

Christos

I managed to do it by creating different ColumnDataSources for each line. I created 2 different ones and plotted p.MultiLine twice times (source1: solid line-home games, source2: dashed-away).

I am still open to better ideas.

Cheers

···

On Monday, July 16, 2018 at 1:13:49 PM UTC+1, Christos Alogoskoufis wrote:

Hello,

I am plotting some football data. The graph shows results per matchday for one team using vertical lines and the length of the line represents the change in league position. I used p.multiline to plot each line. I am trying to make lines dashed if the team played away and normal if the team played at home. I have a separate column called “Game” which indicates whether the game was played home or away.

Ideally I would want to make the line dashed if the value on the “Game” column is equal to “Away”. I thought about using Boolean indexing on my dataframe columns in order to select only the away games and then plot them separately but that would make my columns in my ColumnDataSource unequal in length as I am plotting circles on the graph as well.

Are there any suggestions on how to make the lines dashed?

Thank you,

Christos