mplfinance
mplfinance copied to clipboard
How can I change the Xtick of the plot
As the picture shows, How can i change the Xtick to show the date by day.
This is not directly available right now, but is definitely on the list of things to do. In the meantime you may try returnfig=True
and see if there is a way to get creative and manipulate the xticks through the figure and axes list that are returned.
You'll need to customize the tick locator. For example:
from matplotlib.ticker import MultipleLocator
fig, axlist = mpl.plot(..., returnfig=True)
axlist[0].xaxis.set_minor_locator(MultipleLocator(1))
Note: this is untested code. I don't remember if it the bottom ticks is a major or minor ticks. You might need to change change minor
to major
. Also with small charts the text will surely overlap.
This is how it might look like
@char101: Hi, I tried your set_minor_locator
suggestion in Google Colab with Version is 0.12.7a17. It did not work for me :(
One request: If I may ask, can you share the code for the image you shared ? (It looks super cool to me). Wizardry kind of 😄
@msampathkumar Sorry it has been too long and I don't have the code anymore. To do most of the customization, most of the time you only need two things: access to the axes variable and matplotlib documentation.