[ad_1]
A number of months again I wrote an article about bar charts and the way you can make them clear, self-explanatory, and visually pleasing to the viewers with the intention to inform a extra compelling story (hyperlink beneath).
On this article I look into line charts as a substitute, which produce other specificities which might be price exploring.
Matplotlib makes it fast and straightforward to plot information with off-the-shelf features however the effective tuning steps take extra effort.
I spent fairly a while researching finest practices to construct compelling charts with Matplotlib, so that you don’t need to.
The thought is to go from this…
… to that:
All photos, except in any other case famous, are by the creator.
For instance the methodology, I used a public dataset containing nations’ GDP data over the previous 50 years:
Supply: World Financial institution nationwide accounts information, and OECD Nationwide Accounts information information.
License URL: https://datacatalog.worldbank.org/public-licenses#cc-by
License Kind: CC BY-4.0
After importing the required packages to learn the info and construct our graphs, I merely filtered on the Prime 20 nations of 2022:
import pandas as pd
import matplotlib.pyplot as plt
from datetime import timedelta# Learn the info
df = pd.read_csv('88a1e584-0a94-4e73-b650-749332831ef4_Data.csv', sep=',')
df.drop(['Series Name', 'Series Code', 'Country Code']…
[ad_2]
Source link