3
ax4.plot_date(x=days, y=MACD_14_21,fmt="r-",label='MACD_14_21')

I am trying to print label using label="xxx", while plotting the data, but I don't see any label printed. Do I need to use different syntax?

Tony Babarino
  • 3,355
  • 4
  • 32
  • 44
nnnnmmm
  • 233
  • 2
  • 6
  • 17

1 Answers1

0

These labels are for legend only. Add plt.legend() to Your code to show it. If You want to add labels on the x-axis You can do it with plt.xlabel(['label1','label2']).


Edit:

Unhappily adding labels on plotted lines, is much more complex, and I would recommend You to stick to the legend, because there is no automatic way of doing that. However if You really need to achieve that, it's explained here: Print string over plotted line (mimic contour plot labels)

For simple cases You can also use annotations.

Community
  • 1
  • 1
Tony Babarino
  • 3,355
  • 4
  • 32
  • 44