0

How can I set different colors (e.g. #0088BC and #FF8B00) for each letter (or group of characters) for the label of one data series in a Python plot?

mannaroth
  • 1,473
  • 3
  • 17
  • 38

2 Answers2

2

I do not think you can have different colors for different letters in the same label. You might try this workaround here: matplotlib two different colors in the same annotate

R. Wayne
  • 417
  • 1
  • 9
  • 17
  • It seems like you're right, there is no way to have different colors for different characters in a label since it's a text object. I guess I have to do it the manual and complicated way... – mannaroth Dec 28 '17 at 19:04
1

not sure it is exactly what you want to do, but in matplotlib you can customize whatever you want, as well as the label color,

Example :

import matplotlib
import matplotlib.pyplot as plt
matplotlib.rc("axes", labelcolor="r")
plt.plot(range(10))
plt.xlabel("xlabel")
plt.show()

Check here for more customization.

Fou
  • 161
  • 1
  • 9
  • 1
    I wanted to change the color for every character of one label, this changes it for all of them. Thank you for the effort though! :) – mannaroth Dec 28 '17 at 19:05