Home > other >  Online, etc., consult matplotlib draw text color histogram modification of illustration
Online, etc., consult matplotlib draw text color histogram modification of illustration

Time:09-22

Consult matplotlib histogram how to modify the legend the color of the text, such as online:
 PLT. Bar (x, x_data2, color='gold', label='USES classification 1, width=width) # color=' RGB '
is random colorPLT. Bar (x, x_data3, bottom=x_data2, label='USES classification 2, color=' lightgrey ', width=width)
Font1={' family ':' KaiTi ', 'weight' : 'normal' and 'size: 11}
PLT. Legend (loc=2, frameon=False, fontsize=11, labelspacing=0.8, prop=font1)


CodePudding user response:

Online, such as

CodePudding user response:

How to change? B: and I can't,

CodePudding user response:

Watched some information online, it seems the legend can only use the default color, can't change it

CodePudding user response:

Consult, illustrations in the text color of the modified method is solved?

CodePudding user response:

https://stackoverflow.com/questions/18909696/how-to-change-the-text-colour-of-font-in-legend
Finally found...
The import pylab as PLT

Legs=PLT. Legend (framealpha=0, loc='best')
For the text in legs. Get_texts () :
PLT. Setp (text, color='w')