Time series plot / Matplotlib

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)

Recommended Posts

Time series plot / Matplotlib
[Python] Plot time series data
Time series plot started ~ python edition ~
Time Series Decomposition
Reformat the timeline of the pandas time series plot with matplotlib
matplotlib Write text to time series graph
Python: Time Series Analysis
2-axis plot with Matplotlib
Python time series question
RNN_LSTM1 Time series analysis
Time series analysis 1 Basics
2D plot in matplotlib
Plot CSV of time series data with unixtime value in Python (matplotlib)
3D plot with matplotlib
Display TOPIX time series
Time series analysis related memo
Stackable bar plot with matplotlib
Time series analysis part 4 VAR
Time series analysis Part 1 Autocorrelation
Calculation of time series customer loyalty
Create plot animation with Python + Matplotlib
Easy time series prediction with Prophet
Python: Time Series Analysis: Preprocessing Time Series Data
Time series analysis practice sales forecast
About time series data and overfitting
When plotting time series data and getting a matplotlib Overflow Error
[Statistics] [Time series analysis] Plot the ARMA model and grasp the tendency.
Movement statistics for time series forecasting
Time series analysis 3 Preprocessing of time series data
Continuously color with matplotlib scatter plot
Cases using pandas plot, cases using (pure) matplotlib plot
Lognormal probability plot with Python, matplotlib
LSTM (1) for time series forecasting (for beginners)
Plot multiple maps and data at the same time with Python's matplotlib
Time series analysis 2 Stationary, ARMA / ARIMA model
Predict time series data with neural network
How to compare time series data-Derivative DTW, DTW-
Time series analysis 4 Construction of SARIMA model
How to handle time series data (implementation)
Reading OpenFOAM time series data and sets data
Time series analysis # 6 Spurious regression and cointegration
Format and display time series data with different scales and units with Python or Matplotlib