0
Ich möchte alle 13 x Ticks anzeigen, aber das Diagramm zeigt nur 7 von ihnen mit zwei Intervallen.Steuern der Anzahl der x-Ticks in pyplot
plt.locator_params(axis='x',nbins=13)
Warum nicht über Code Arbeit ??
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.dates as dates
y = [0, 0.86, 0.826, 0.816, 0.807, 0.803, 0.804, 0.803, 0.802,0.81, 0.813, 0.813, 0.813]
times = pd.date_range('2015-02-25', periods=13)
fig, ax = plt.subplots(1)
fig.autofmt_xdate()
xfmt = dates.DateFormatter('%d-%m-%y')
ax.xaxis.set_major_formatter(xfmt)
plt.locator_params(axis='x',nbins=13)
ax.plot_date(times.to_pydatetime(), y, 'v-')
ax.xaxis.set_minor_locator(dates.WeekdayLocator(byweekday=(1),
interval=1))
ax.xaxis.set_minor_formatter(dates.DateFormatter('%d\n%a'))
ax.xaxis.grid(True, which="minor")
ax.yaxis.grid()
plt.tight_layout()
plt.show()
Wenn eine Antwort Ihre Frage [accept it] (http://i.stack.imgur.com/QpogP.png) beantwortet, damit andere wissen, dass es auf den ersten Blick funktioniert. – Yugi