plot - Plot, various specialized plotting functions and associated utilities

plot: SpacePy plotting routines

This package aims to make getting publication ready plots easier. It provides classes and functions for different types of plot (e.g. Spectrogram, levelPlot), for helping make plots more cleanly (e.g. set_target, dual_half_circle), and for making plots convey information more cleanly, with less effort (e.g. applySmartTimeTicks, style).

This plot module now provides style sheets. For most standard plotting we recommend the default style sheet (aka spacepy). To apply the default plot style, use the following:

import spacepy.plot as splot
splot.style()

Changed in version 0.5.0: Plot styles are no longer applied automatically.

Different plot types may not work well with this style, so we have provided alternatives. For polar plots, spectrograms, or anything with larger blocks of color, it may be better to use one of the alternatives:

import spacepy.plot as splot
splot.style('altgrid') # inverts background from default so it's white
splot.style('polar') # designed for filled polar plots
splot.revert_style() # put the style back to matplotlib defaults

Authors: Brian Larsen and Steve Morley Institution: Los Alamos National Laboratory Contact: balarsen@lanl.gov

Copyright 2011-2016 Los Alamos National Security, LLC.

add_logo(img[, fig, pos, margin])

Add an image (logo) to one corner of a plot.

annotate_xaxis(txt[, ax])

Write text in-line and to the right of the x-axis tick labels

applySmartTimeTicks(ax, time[, dolimit, dolabel])

Given an axis ax and a list/array of datetime objects, time, use the smartTimeTicks function to build smart time ticks and then immediately apply them to the given axis.

available([returnvals])

List the available plot styles provided by spacepy.plot

collapse_vertical(combine[, others, leave_axis])

Collapse the vertical spacing between two or more subplots.

dual_half_circle([center, radius, ...])

Plot two half circles to a plot with the specified face colors and rotation.

levelPlot(data[, var, time, levels, target, ...])

Draw a step-plot with up to 5 levels following a color cycle (e.g.

plot(*args, **kwargs)

Convenience wrapper for matplotlib's plot function

revert_style()

Revert plot style settings to those in use prior to importing spacepy.plot

set_target(target[, figsize, loc, polar])

Given a target on which to plot a figure, determine if that target is None or a matplotlib figure or axes object.

shared_ylabel(axes, txt, *args, **kwargs)

Create a ylabel that spans several subplots

solarRotationPlot(ticks, data[, targ_ax, ...])

Plots a 1-D time series as a Carrington or Bartels plot

Spectrogram(data, **kwargs)

This class rebins data to produce a 2D data map that can be plotted as a spectrogram

style([look, cmap])

Apply SpacePy's matplotlib style settings from a known style sheet.

timestamp([position, size, draw, strnow, ...])

print a timestamp on the current plot, vertical lower right

add_arrows(lines[, n, size, style, ...])

Add directional arrows along a plotted line.

Most of the functionality in the plot module is made available directly through the plot namespace. However, the plot module does contain several submodules listed below

carrington

Module for plotting data by Carrington or Bartels rotation

spectrogram

Create and plot generic 'spectrograms' for space science.

utils

Utility routines for plotting and related activities