以下是一个示例代码:
g = new Dygraph(div, data, {
series: {
YourSeries: {
axis: 'y2'
}
}
});
为什么大熊猫import pandas as pd
from datetime import datetime, timezone
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import datetime as dt
x = []
d = dt.datetime(2013, 7, 4)
for i in range(30):
d = d + dt.timedelta(days=1)
x.append(d)
y = range(len(x))
df = pd.DataFrame({'x': x, 'y': y})
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%d-%m-%Y'))
plt.gca().xaxis.set_major_locator(mdates.DayLocator(interval=5))
# Line A
# plt.bar(x, y, align='center') # center the bars on their x-values
# Line B
# df.plot(x='x', y='y', kind='bar', ax=plt.gca())
plt.title('DateLocator with interval=5')
plt.gcf().autofmt_xdate()
plt.show()
不尊重轴配置?
这是我的Dataframe.plot
:
conda env export