I have some data where I have deaths each year across each state. I am attempting to make several small line graphs (sort of like what's demonstrated here), however, I cannot get my data to go the way it seems to need to go to make this.
Without attempting this method, I attempted df.pivot(index="fyear", columns="state_abbr", values="total_deaths").plot()
which of course just put 50 lines on one graph...not a great look.
How do I get individual line graphs for each state in a neat, organized way? (well, as neat as you can get with 50 graphs)
Sample Data
data = {'state_abbr':['AL', 'AK', 'AZ', 'AL', 'AK', 'AZ', 'AL', 'AK', 'AZ',],
'fyear':[2014, 2014, 2014, 2015, 2015, 2015, 2016, 2016, 2016],
'total_deaths':[500, 490, 510, 530, 480, 510, 600, 400, 230]}
df = pd.DataFrame(data)
question from:
https://stackoverflow.com/questions/66056359/plot-multiple-small-line-graphs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…