我从源
安装了所有依赖于ubuntu 14.04的matplotlibProcessing dependencies for matplotlib==1.3.1
Searching for nose==1.3.3
Best match: nose 1.3.3
Processing nose-1.3.3-py2.7.egg
Removing nose 1.3.1 from easy-install.pth file
nose 1.3.3 is already the active version in easy-install.pth
Installing nosetests script to /usr/local/bin
Installing nosetests-2.7 script to /usr/local/bin
Using /usr/local/lib/python2.7/dist-packages/nose-1.3.3-py2.7.egg
Searching for pyparsing==2.0.1
Best match: pyparsing 2.0.1
Adding pyparsing 2.0.1 to easy-install.pth file
Using /usr/lib/python2.7/dist-packages
Searching for tornado==3.1.1
Best match: tornado 3.1.1
tornado 3.1.1 is already the active version in easy-install.pth
Using /usr/lib/python2.7/dist-packages
Searching for python-dateutil==1.5
Best match: python-dateutil 1.5
python-dateutil 1.5 is already the active version in easy-install.pth
Using /usr/lib/python2.7/dist-packages
Searching for numpy==1.8.1
Best match: numpy 1.8.1
numpy 1.8.1 is already the active version in easy-install.pth
当我尝试绘制某些内容时,matplotlib没有显示正确的x刻度,你可以从这里看到 http://bayanbox.ir/id/4106587232464013527?view
来源:
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
import numpy as np
df=pd.DataFrame({'Val': np.random.random(50)})
df.index=pd.date_range('2000-01-02', periods=50)
plt.plot_date(df.index.to_pydatetime(), df.Val, fmt='-')
ax=plt.gca()
ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%y%b\n%d'))
plt.show()