plot_lib Module
This is the plot_lib module. This has plotting functions for single panels. Most users will not interact with this.
A simple plotting library used by SSINS.Catalog_Plot. Direct interaction with these functions is unnecessary.
- SSINS.plot_lib.hist_plot(fig, ax, data, bins='auto', yscale='log', xscale='linear', label='', legend=True, title='', xlabel='', ylim=None, density=False, model_func=None, error_sig=0, model_label='', color='blue', model_color='orange', alpha=0.5, font_size='medium', **model_kwargs)[source]
A function that calculates and plots histograms. Can also make models using the model_func argument, including error shading.
- Parameters:
fig – The figure object to modify
ax – The axis object to modify
data – The data to be histogrammed
bins – The bins for the histogram. See numpy.histogram documentation
yscale ('log' or 'linear') – The scale for the vertical axis. Default is ‘log’
xscale ('log' or 'linear') – The scale for the horizontal axis. Default is ‘linear’
label – The legend label for the data
legend – If True, show the legend
title – The title for the plot
xlabel – The label for the horizontal axis
ylim – The limits for the vertical axis
density – If True, report probability density instead of counts
model_func – Default is None. Set to a callable function of the bin edges to make a model histogram.
error_sig – Default is 0. If greater than zero, draw error shades out to error_sig sigma (significance).
model_label – The legend label for the model
color – The color of the drawn histogram
model_color – The color of the drawn model (and errors)
alpha – The transparency parameter for the error shades.
model_kwargs – Additional kwargs not included in the above list will be passed to model_func
font_size – Fontsize is set globally here
- SSINS.plot_lib.image_plot(fig, ax, data, cmap=None, vmin=None, vmax=None, title='', xlabel='', ylabel='', midpoint=False, aspect='auto', cbar_label=None, xticks=None, yticks=None, log=False, xticklabels=None, yticklabels=None, mask_color='white', cbar_ticks=None, font_size='medium', symlog=False, linthresh=1, extent=None, extent_time_format='jd', convert_times=True, lst_prec=2, extend='neither', alpha=None)[source]
Plots 2-d images. Can do a midpoint normalize and log normalize.
- Parameters:
fig – The fig object to modify
ax – The axis object to modify
data – The data to plot
cmap – Name of a colormap from matplotlib
vmin – The minimum value for the colormap
vmax – The maximum value for the colormap
title – The title for ax
xlabel – The horizontal axis label
ylabel – The vertical axis label
midpoint – Whether to set the midpoint of the colormap to zero (useful for diverging colormaps)
aspect – Adjusts aspect ratio, see ax.imshow documentation in Matplotlib
cbar_label – The label for the colorbar
xticks – The ticks for the horizontal axis
yticks – The ticks for the vertical axis
log – If True, set a logarithmic scale for the colormap
symlog – If True, set a symmetric logarithmic scale for the colormap
linthresh – region for symlog (if enabled) to act linearly to avoid divergence at zero
xticklabels – The labels for the xticks
yticklabels – The labels for the yticks
mask_color – The color for masked data values, if any
cbar_ticks – The tickmarks for the colorbar
font_size – Font size is set globally with this parameter.
extent – Passes to imshow to determine ticks.
extent_time_format – a string specifying the format of the times passed in the extent keyword.
convert_times – Will convert a JD to UTC or LST in radians to an LST in hourangle, both using astropy.
lst_prec – Number of sig figs to keep in LST hourangle ticklabel
extend – Whether to extend the colorbar.
alpha – Set a transparency factor
- Note for arguments midpoint, log, symlog, linthresh:
Only one of these arguments can be expressed in the plot (can’t have a plot with multiple different colorbar metrics).
If multiple of these arguments are passed, default is linear (midpoint) followed by log, symlog.
Linthresh only applies when using symmetrical log (symlog) and will be ignored otherwise.