The x-axis is provided python matplotlib text display interval (after the digital words can be converted to character)

A drawing problems encountered by international friends, checked first-hand information. The main reference is the brother of this practice ( https://blog.csdn.net/wyquin/article/details/80508260 )

#totalSeed line graph corresponding to Y
FIG1, AX = plt.subplots () 
ax.plot (totalSeed, df.loc [:, ' MACDhist_1 ' ]) 
ax.plot (df.loc [:, ' MACDhist_2 ' ]) 
ax.plot (df.loc [: , ' MACDhist_5 ' ]) 
ax.plot (df.loc [:, ' MACDhist_20 ' ]) 
plt.legend (LOC = ' SouthEast ' ) 
xticks = List (Range (0, len (totalSeed), 40 )) set here # x-axis is the position of the point 
xlabels = [totalSeed [x] for x in xticks] # X axis set value corresponding to that point where the totalseed 
xticks.append (len (totalSeed)) 
xlabels.append (totalSeed [ -1])
ax.set_xticks(xticks)
ax.set_xticklabels(xlabels, rotation=40)

Pirates of the renderings is that my brother

 

Guess you like

Origin www.cnblogs.com/z1141000271/p/11628079.html