pyplot: change the number of x labels (from 6)

Paulo da Silva p_s_d_a_s_i_l_v_a_ns at netcabo.pt
Wed Jan 10 13:01:43 EST 2018


Às 09:17 de 10-01-2018, Thomas Jollans escreveu:
> On 2018-01-10 05:22, Paulo da Silva wrote:
>> Hi all.
>>
...

> 
> It's a bit hard to tell without a working example, but I think you'll
> want to set a tick locator, e.g. something like
> ax0.xaxis.set_major_locator(matplotlib.ticker.MultipleLocator(1))

Basically I have a list of hundred of dates (one per point) and I want 
few of them, to fill the X axis. This should be simple!
The code I have (too complex for the task, btw), from the internet, does 
exactly that, including presenting them 45º oriented, but only presents 
5 or 6 dates. I want more, perhaps 12.

> 
> Read this: https://matplotlib.org/api/ticker_api.html
> 
> The old-fashioned way would be to set to tick locations manually with
> https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.set_xticks.html
> 
Yes, I need to look at this ...

Thank you.



More information about the Python-list mailing list