I’m trying to add a colored line/marker next to my axis labels to help identify which line corresponds to which axis when I have multiple y-axes and datasets one a plot.
Something like this:
— Label
where the — dash would be e.g. red (matching the line color), and the rest of the text stays black.
I seen that there is a “withdash“ argument that’s deprectated but that’s what I would need for my case I guess.
Something like this, with colored dots or dashes next to/in between labels :
To be honest, this is only a Matplotlib constraint.
You cannot partly color a dash and leave the remainder black in matplotlib as axis labels are single Text objects until you begin stacking numerous text artists. There is no built-in substitute for withdash.
cleanest solution? Avoid making a rush. To match the line, just color the axis label + ticks: