ich die Antworten gelesen habe bereits im Zusammenhang mit diesem und habe dies gefolgt:Wie Plots in Abbildung aggregieren mit Nebenhandlungen
fig = plt.figure()
fig.add_subplot(221) #top left
fig.add_subplot(222) #top right
fig.add_subplot(223) #bottom left
fig.add_subplot(224) #bottom right
plt.show()
Das ist sehr gut, jetzt habe ich eine Figur mit vier leeren Nebenhandlungen.
Was ich nicht herausfinden kann, ist, wie die Unterplot zu zeigen, mein Grundstück x
wo x ist ein matplotlib.axes.AxesSubplot
, dass ich bereits generiert habe.
insgesamt Mein Code ist:
plt1 = plot.scatter(foo,bar)
plt2 = plot.line(bar, baz)
plt3 = plot.scatter(you, get)
plt4 = plot.line(the, picture)
fig = plt.figure()
fig.add_subplot(221) #top left
fig.add_subplot(222) #top right
fig.add_subplot(223) #bottom left
fig.add_subplot(224) #bottom right
# Here is where I got lost
# I want figure subplot 221 to show plt1 etc...
Ich denke, was mich aufhält, ist, dass 'ax1.plot (...)' eine Menge der Formatierungen entfernt, die ich mit 'erreichen konnte df [['col1', 'col2']]]. plot() ', dh Anzeige des Index der Datumsstempel als x-Achse anstelle von Index n und Achsentiteln usw. Das Diagramm, das ich mag, wird generiert von 'statusPlt = df [['a', 'b', 'c']]. plot (title = 'Status von stuff by Create Date')' was mir ein schönes Liniendiagramm zeigt, gruppiert nach Spaltenwert über dem Datumsindex Ersetzen Sie es mit 'ax1.plot (df [['a', 'b', 'c']])' zeigt die x-Achse als Indexwert –
, also sollten Sie 'df [['col1' tun , 'col2']]. plot (ax = ax1) ' –
@TylerWood und setzen Sie die Formatierung direkt auf die Achsen (zB' ax.set_xlabel (...) ') –