Python Forum
remove weekends from matplot - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: remove weekends from matplot (/thread-20413.html)



remove weekends from matplot - mr_byte31 - Aug-09-2019

I am plotting some charts and I noticed that I have gaps in the weekend days.
I want to remove the weekend days from the chart.


from matplotlib.dates import (DateFormatter, MonthLocator,date2num)

months = MonthLocator()
daysFmt = DateFormatter("%d %b %y")
The picture looks like :

[attachment=693]

Gaps are highlighted in red circles.

any support ?


RE: remove weekends from matplot - scidam - Aug-10-2019

I don't think it is possible to use discontinuous axis with matplotlib. However,
you can try to plot your data versus some index, e.g. [1, ..., N] (no dates),
and assign custom formatted labels to that index (and, finally, rotate them on 45 deg).


RE: remove weekends from matplot - mr_byte31 - Aug-10-2019

you can try to plot your data versus some index, e.g. [1, ..., N] (no dates),
I understand this sentence and I already did it.

and assign custom formatted labels to that index (and, finally, rotate them on 45 deg).
what do u mean by this ?


RE: remove weekends from matplot - DeaD_EyE - Aug-10-2019

Here is an example how to rotate the Labels on the X-Axis.