No issue: change x axis to dates instead of epoch time.
This commit is contained in:
Родитель
23de82d1b3
Коммит
426b56dfb5
|
@ -203,13 +203,20 @@ def build_csv(
|
|||
|
||||
try:
|
||||
from matplotlib import pyplot as plt
|
||||
plot_allphs = optimize_for_plotting(allphs)
|
||||
plt.figure()
|
||||
plt.scatter([v[0] for v in allphs], [v[1] for v in allphs])
|
||||
plt.plot_date([v[0] for v in plot_allphs], [v[1] for v in plot_allphs])
|
||||
plt.show()
|
||||
except ImportError:
|
||||
print("Skipping print stage, cannot find matplotlib")
|
||||
return
|
||||
|
||||
def optimize_for_plotting(data):
|
||||
import matplotlib.dates
|
||||
def transform_row(row):
|
||||
matplot_date = matplotlib.dates.epoch2num(row[0])
|
||||
return [matplot_date] + row[1:]
|
||||
return [transform_row(list(row)) for row in data]
|
||||
|
||||
if __name__=="__main__":
|
||||
args = csv_generation_parser().parse_args()
|
||||
|
|
Загрузка…
Ссылка в новой задаче