Introduction to Data Viz | Python

Session Overview

  • Plotting Libraries
  • Best Practices
  • Saving
  • Play Time!

Plotting Libraries

Best Practices

  • Use Layers
  • Keep it Simple
  • Show what you want to show
  • Labels + Documentation
  • Colors

Saving

  • Vector vs Raster Images
  • Lossless Formats:
    • PNG
    • TIFF
    • BMP
    • GIF
  • Save it in your code - Don’t export it later…

Example

Matplotlib


import xarray as xr
import matplotlib.pyplot as plt

cmorph_data = xr.open_dataset('./CMORPH_V1.0_ADJ_0.25deg-DLY_00Z_20020403.nc')

cmorph_data

cmorph_data['cmorph'].plot()

cmorph_data['cmorph'].plot().figure.savefig('cmorph.png')

Play Time!