Home > other >  Matplotlib problem about python, why the plot import value can only display coordinate axis is not t
Matplotlib problem about python, why the plot import value can only display coordinate axis is not t

Time:09-16

Data is two columns of Numbers, as shown in figure

The import pandas as pd
The import matplotlib. Pyplot as PLT
Data=https://bbs.csdn.net/topics/pd.read_csv (' usdxvix. CSV, index_col=0, parse_dates=True, dayfirst=True)
FIG=PLT. Figure (figsize=16 (6), dpi=100)
Ax=FIG. Add_subplot (1, 1, 1)
X=data. The index
Y=data. Values
Ax. The plot (x, y, color='# 2 b4750, our linewidth=2, graphics.linestyle=' - ')
Ax. Set_xlim (1, len (x) + 1)
Ax. Set_ylim (y.m in () * 0.8, y.m ax () * 1.2)
Ax. Set_xticks (range (0, len (x), 80))
Ax. Set_xticklabels ([x [I] strftime (' Y - m - % d % %) for the I in ax. Get_xticks ()], rotation=90).
PLT. The plot (x, y, color='# 2 b4750, our linewidth=2, graphics.linestyle=' - ')
Why the output axis is only an empty?

CodePudding user response:

First to see if data is not passed, it should be passed date, Y not passed
  • Related