Visualisieren Sie die Timing-Eingabe und -Ausgabe|Python

Bitte helfen Sie mir, den Python-Code für die Visualisierung zu generieren. Die Eingabe ist die Variable xxx, die Ausgabe ist die Variable xxx und die Abszisse ist die Zeit. Die Eingabe wird durch eine blaue Linie und die Ausgabe durch eine gelbe Linie dargestellt. und dann sind die Eingabe und die Ausgabe jeweils eins vor der Zeitdimension. , eins danach.

import matplotlib.pyplot as plt

data = [1.310, 1.307, 1.307, 1.307, 1.307, 1.307, 1.307, 1.307, 1.307, 1.307]
output = [2.1, 2.5, 2.7]

time_input = range(len(data))
time_output = range(len(data), len(data) + len(output))
ground_truth = [1,2,3]


plt.plot(time_input, data, 'b-', label='Input')
plt.plot(time_output, output, 'y-', label='Output')
plt.plot(time_output, ground_truth, 'b-', label='GT')

plt.xlabel('Time')
plt.ylabel('Value')
plt.legend()

plt.show()

 

Ich denke du magst

Origin blog.csdn.net/weixin_43332715/article/details/131942503
Empfohlen
Rangfolge