<div dir="auto">No. Do I use a string with it?<br><br><div data-smartmail="gmail_signature">Sent from my Android.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On May 1, 2017 2:50 PM, "Klymak Jody" <<a href="mailto:jklymak@uvic.ca">jklymak@uvic.ca</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Did you try ax.set_xlim after your tick locator calls?<br>
<br>
Cheers. Jody.<br>
<br>
Sent from my iPhone<br>
<br>
> On May 1, 2017, at 11:29, Isaac Gerg <<a href="mailto:isaac.gerg@gergltd.com">isaac.gerg@gergltd.com</a>> wrote:<br>
><br>
> Hi all,<br>
><br>
> I am trying to make a plot from a pandas dataframe and i cannot for the life of me get the xlabels to stay within range of the data. Any suggestions?<br>
><br>
> attached is the plot in question. The code is:<br>
><br>
> plt.figure()<br>
> fig = matplotlib.pyplot.gcf()<br>
> fig.set_size_inches(16,9)<br>
> plt.title('Number Abnormal Events Per Week By Type')<br>
> plt.bar(tmp2.index, tmp2['loose'], color='C1', width=4)<br>
> plt.bar(tmp2.index, tmp2['hard'], color='C2', width=4, bottom=tmp2['loose'])<br>
> plt.ylabel('Count')<br>
> plt.xlabel('Week')<br>
> plt.legend(['l','h'])<br>
> plt.xticks(rotation='vertical'<wbr>)<br>
> ax = matplotlib.pyplot.gca()<br>
> ax.xaxis.set_major_formatter(<wbr>matplotlib.dates.<wbr>DateFormatter('%Y-%m-%d'))<br>
> ax.xaxis.set_major_locator(<wbr>mdates.WeekdayLocator(<wbr>byweekday=mdates.MO))<br>
> plt.savefig(r'output\abnormal.<wbr>png', bbox='tight')<br>
><br>
> with<br>
><br>
> tmp2.index<br>
> DatetimeIndex(['2017-01-02', '2017-01-09', '2017-01-16', '2017-01-23',<br>
> '2017-01-30', '2017-02-06', '2017-02-13', '2017-02-20',<br>
> '2017-02-27', '2017-03-06', '2017-03-13', '2017-03-20',<br>
> '2017-03-27', '2017-04-03', '2017-04-10', '2017-04-17',<br>
> '2017-04-24'],<br>
> dtype='datetime64[ns]', name='datetime', freq='W-MON')<br>
><br>
><br>
> I would like to remove the xlabels on either end of the data (12-26 and 05-01).<br>
><br>
> Thanks,<br>
> Isaac<br>
> <abnormal.png><br>
> ______________________________<wbr>_________________<br>
> Matplotlib-devel mailing list<br>
> <a href="mailto:Matplotlib-devel@python.org">Matplotlib-devel@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/matplotlib-devel" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/matplotlib-<wbr>devel</a><br>
<br>
</blockquote></div></div>