pyValEIA.plots.utils

Utility functions for formatting or creating plots.

Functions

format_latitude_labels(ax[, xy])

Format the latitude axis labels with degree symbols and N/S suffixes.

latitude_formatter(latitude, pos)

Format latitude ticks to include degrees and hemisphere, removing signs.

longitude_formatter(longitude, pos)

Format longitude ticks to include degrees and hemisphere, removing signs.

format_longitude_labels(ax[, xy])

Format the longitude axis labels with degree symbols and E/W suffixes.

make_legend(leg_ax, leg_labs, leg_cols, leg_styles, ...)

Create a custom legend on a given axis.

daynight_label(model[, LT_range])

Generate Label for local time day and night.

Module Contents

pyValEIA.plots.utils.format_latitude_labels(ax, xy='x')[source]

Format the latitude axis labels with degree symbols and N/S suffixes.

Parameters:
axmatplotlib.axes.Axes

The Matplotlib axes object to format

xystr

Specifies whether the x or y axis is being formatted (default=’x’)

pyValEIA.plots.utils.latitude_formatter(latitude, pos)[source]

Format latitude ticks to include degrees and hemisphere, removing signs.

Parameters:
latitudefloat

Latitude tick value in degrees from -90 to 90.

posfloat

Position, not used but required for use as FuncFormatter

Returns:
lat_strstr

Formatted latitude string

Notes

Designed for use within mpl.ticker.FuncFormatter

pyValEIA.plots.utils.longitude_formatter(longitude, pos)[source]

Format longitude ticks to include degrees and hemisphere, removing signs.

Parameters:
longitudefloat

Longitude tick value in degrees from -180 to 360.

posfloat

Position, not used but required for use as FuncFormatter

Returns:
lon_strstr

Formatted latitude string

Notes

Designed for use within mpl.ticker.FuncFormatter

pyValEIA.plots.utils.format_longitude_labels(ax, xy='x')[source]

Format the longitude axis labels with degree symbols and E/W suffixes.

Parameters:
axmatplotlib.axes.Axes

The Matplotlib axes object

xystr kwarg

‘x’, ‘y’, or ‘z’ depending on which axis you want to have the degree symbol with E/W formatting (default=’x’)

Raises:
ValueError

If unknown axis supplied.

pyValEIA.plots.utils.make_legend(leg_ax, leg_labs, leg_cols, leg_styles, modes, **kwargs)[source]

Create a custom legend on a given axis.

Parameters:
leg_axmatplotlib axis

Axis to place the legend on.

leg_labslist of str

Labels for the legend entries.

leg_colslist of str

Colors for the legend entries.

leg_styleslist of str

Marker styles (if scatter) or line styles (if line).

modeslist of str

Type of legend entry for each label. Options: “line”, “scatter”, “shading”, “line+shading”.

kwargsdict

Additional keyword arguments passed to ax.legend().

pyValEIA.plots.utils.daynight_label(model, LT_range=None)[source]

Generate Label for local time day and night.

Parameters:
modelpd.DataFrame

model dataframe build by states_report_swarm

LT_rangelist-like or NoneType

Range of day night local time, or None for default of [7, 19] (default=None)

Returns:
lab_daystring

legend label for daytime

lab_nightstring

legend label for nighttime