/plotting-examples

Reimplementation with Python/Matplotlib/Pandas: Matt's fork of Jon Herman's Matlab plotting examples

Primary LanguagePython

This fork is out of date since Jon gave me permission to write to his repo. I've made all my updates to that repo instead. Nothing to see here, move along.

Plotting Examples

Some examples for plotting different types of data in Matlab and Python

Contributors: jdherman and matthewjwoodruff

See example_images/ for the outputs from these files (PNG). Note that publication-quality figures will usually require a vector graphics format (SVG/EPS/PDF) along with some manual editing to improve font clarity, etc. The examples shown here are in unedited raster format and are only meant to be illustrative.

Column data

From example_data/column_data.txt. Used with:

  • line_plot.{m,py}: Standard line plot with different formatting options

Image

  • fill_between.py: Same data as line_plot, with shaded fill between Series 1 and Series 2

Image

  • stacked_area.m: Stacked area plot with color options

Image

  • animated_gif.{m,py}: Save loop of images as a .gif animation. The Python version requires you to use imagemagick after the fact to stick the frames together: convert -delay 15 -loop 0 frame*png animation.gif.

Image

  • histogram_cdf.m: Standard plots of frequency distributions

Image

  • parallel_coordinate.m: Plots row entries as lines instead of columns. Options to scale all values between [0,1] and toggle solutions on/off above/below a certain threshold. (These functions are included in /util/).

Image

Gridded 2D data

From example_data/gridded_2D.txt. Used with:

  • imagesc_plot.m: Show matrix values directly as color blocks

Image

  • contour_surf.{m,py}: Contour, filled contour, and surface plots of meshgrid data

Image

Non-Gridded 2D data (e.g. experimental data)

From example_data/non_gridded_2D.txt. The data file contains rows of (x,y,z) points that are not on a regular grid. Used with:

  • scatter_plot.{m,py}: Plot the irregularly spaced points as dots, with Z values as the color

Image

  • contourf_non_gridded.{m,py}: Use Matlab's built-in griddata function to interpolate the data onto a standard meshgrid, which can then be used for standard contour/mesh/surf plots, etc.

Image