Help us understand the problem. What is going on with this article?

時系列プロット / Matplotlib

More than 3 years have passed since last update.
data.txt
# data1,data2
2016-01-23,12
2016-01-24,15
2016-01-25,11
...
2016-03-09,20
time_series.py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import dateutil

(data1, data2) = np.loadtxt("data.txt",
                            delimiter=",",
                            dtype=int)

data2 = np.array([datautil.parser.parse(v) for v in data2])

fig = plt.figure(figsize=(10,10), dpi=100)
ax = fig.add_subplot(111)
ax.xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%d\n%H:%M"))
ax.plot(data1, data2, ".")
ax.set_ylim(-0.1, 1.1)
ax.grid(True)

tk_wada
へっぽこエンジニア。 AI技術、データ分析を使って社会をハッピーにしたい。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away