mplfinance icon indicating copy to clipboard operation
mplfinance copied to clipboard

How can I remove y axis ticker

Open ryzryztc opened this issue 4 years ago • 1 comments

by setting datetime_format='' " i remove tickers on X axis. how can i do the same to the y axis? like in matplotlib plt.yticks([])

ryzryztc avatar Dec 14 '21 09:12 ryzryztc

Depending exactly what you want to accomplish, you can try one of the following:

Given the following plot:

mpf.plot(df,type='candle',volume=True)

image


  • Use kwarg axisoff=True to accomplish the folowing:
mpf.plot(df,type='candle',volume=True,axisoff=True)

image


  • Or use returnfig=True and Axes.set_[xy]ticklabels() to accomplish the following:
fig, axlist = mpf.plot(df,type='candle',volume=True,returnfig=True)
axlist[0].set_xticklabels([])
axlist[0].set_yticklabels([])
axlist[2].set_yticklabels([])
mpf.show()

image


  • or alternatively:
fig, axlist = mpf.plot(df,type='candle',volume=True,returnfig=True)
axlist[0].set_xticklabels([])
axlist[0].set_yticklabels([])
axlist[0].set_ylabel('')
axlist[2].set_yticklabels([])
axlist[2].set_ylabel('')
mpf.show()

image


  • If you are not familiar with returnfig=True click here
  • If you are working inside jupyter notebook, then replease mpf.show() with simply fig

DanielGoldfarb avatar Dec 14 '21 10:12 DanielGoldfarb

To remove the tickers on the y-axis, tick_params() method has an attribute named left and we can set its value to False and pass it as a parameter inside the tick_params() function. It removes the tick on the y-axis.

Anshika91 avatar Oct 12 '22 17:10 Anshika91