Skip to main content

A way to plot data directly from python dictionaries

Project description

# python_plot_wrappers A wrapper for making polished multi-line plots with matplotlib. I wrote this as an easy-to-access interface to make cleaner looking plot code, and not have to retype pyplot syntax over and over. Allows for passing data in as nested dictionaries. All lines are created using a single x-axis data set - essentially a setup to visualize parametric sweeps.

See sample images by following links below:

https://cloud.githubusercontent.com/assets/15716194/11058820/7b1098be-8763-11e5-91d6-53bd5d71437a.png

https://cloud.githubusercontent.com/assets/15716194/11058821/7b109788-8763-11e5-9c2c-ceb7db39b980.png

Pre-requisites: python + matplotlib, numpy, scipy, latex + texlive-fonts-extra, (and maybe texlive-full)

Usage:

plot_wrapper(plot_data, keys, labels, save_folder)

Instructions:

plot_data : Dictionary (level 1) that contains multiple (level 2) dictionaries. Each level 2 dictionary corresponds to a line in the figure(s), and must have the following key/value pairs:

data[‘x’] = x # list of x-axis values to be plotted

data[‘xlbl’] = ‘X axis label’ # string defining x-axis label

data[‘lstyle’] = ‘-’ # line style. can be ‘–’, ‘-’, ‘-.’ or ‘:’. Recommend first 2

data[‘mtype’] = ‘s’ # Marker type for line. Recommend ‘s’,’o’,’^’ or ‘’ for none

data[‘keyname’]= y # data to be plotted on the y axis

data[‘lcolor’] = ‘r’ # line color. Can be ‘r’, ‘b’, ‘k’, ‘m’,….

keys : list of data keys in the level-2 dictionaries that need to be plotted. If multiple level-2 dictionaries havedata under the same key name, these data sets are plotted on the same figure.

labels : y-axis labels (list of strings) that are applied to the y-axis label for each figure, corresponding to entries in the list “keys”. If keys and labels are of different lengths, the shorter list is used to generate figures since I used the zip function.

save_folder : path where you want to save all images. Right now uses png format.

Feel free to modify/add.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyplotwrap-0.25beta.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyplotwrap-0.25beta.linux-x86_64.exe (70.2 kB view details)

Uploaded Source

File details

Details for the file pyplotwrap-0.25beta.tar.gz.

File metadata

  • Download URL: pyplotwrap-0.25beta.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyplotwrap-0.25beta.tar.gz
Algorithm Hash digest
SHA256 89f315d1fb1bc0e060239c44755b904b037dcb94fa202553a8911ac8e5941435
MD5 916c2f55212f16e1d0f290c18e96cc08
BLAKE2b-256 fac215a8bb0c3c957ab542f95e878318ac7914fda4e3d1a741a7c64f3f6eb4c3

See more details on using hashes here.

File details

Details for the file pyplotwrap-0.25beta.linux-x86_64.exe.

File metadata

File hashes

Hashes for pyplotwrap-0.25beta.linux-x86_64.exe
Algorithm Hash digest
SHA256 049dac1f100cb29b4ccecc7cd0f972d48dacdc125d564e6e53eec0a433d1ffc5
MD5 8e12cb9306a1b9cb2c46d91adba1bab6
BLAKE2b-256 d885a86aea21c1dbf694e8b95b2fe9f486634f2c32e6daf5aad8516f7d387053

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page