On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph <sudheer.jos...@yahoo.com>wrote:

> Dear Experts,
>             I have been experimenting with the plot_dates option of
> matplotlib to plot time series data and have below questions
>
>  I have used
> loc = mdates.AutoDateLocator()
> ax.xaxis.set_major_locator(loc)
> ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n %Y'))
>
>
> and got the tick labels in attached plot
>
> However I feel the repeatd year labeling is not needed here and it is
> required once in a year only , Also if I need to plot long time seris
> insted of "MAR" "APR" I wanted to get them reduced to "M" "A" etc so that
> the lavel congestion can be avoided.
>
>
> I notice that below options are available, but was wondering how
> commbinatins of these locateors are used ie mark every month and every year
> once each.
>
>
> Is there a way to achive the above or does it need further development?
>
> fmt = mdates.DateFormatter('%Y-%m-%d')
> loc = mdates.WeekdayLocator(byweekday=mdates.MONDAY,interval=4)
> locator = mdates.YearLocator()
>

If I were trying to do this, I'd cobble something together using by the
minor and major formatters.
e.g.,...
import matplotlib.dates as mdates
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

majorLocs = mdates.MonthLocator(bymonth[1,7])
majorFmt = mdates.DateFormatter('%b\n%Y')

minorLocs = mdates.MonthLocator(bymonth[1,7])
minorFmt = mdates.DateFormatter('%b')

ax.xaxis.set_major_locator(majorLocs)
ax.xaxis.set_major_formatter(majorFmt)

ax.xaxis.set_minor_locator(minorLocs)
ax.xaxis.set_minor_formatter(minorFmt)
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to