myplotting module

myplotting.check_overlaps(bbox1, bbox2)[source]

Returns True if this bounding box overlaps with the given bounding box other. OR IF NANA!

myplotting.convert_wcs_limits(limits, header, frame='fk5')[source]

limits: array-like

(ra_min, ra_max, dec_min, dec_max) all in degrees



(ra_min, ra_max, dec_min, dec_max) all in pixels

myplotting.corner_plot(distributions, plot_grids=None, labels=None, filename=None, logscale=False, confidence_intervals=None)[source]

distributions : array-like

N-dimensional array

plot_grids : list

List of arrays, where each array corresponds to the parameter values of the corresponding axis of the distributions.

labels : list

List of parameter strings.

filename : string

Filename to save to.

logscale : bool

Plot both 1D and 2D PDFs in logscale?

confidence_intervals : array-like

Confidence intervals for 1D distributions. N-dimesional array, with lower, best estimate and upper bounds.

myplotting.delete_overlapping_xlabels(fig, ax)[source]

Deletes overlapping xtick labels in axis.


fig : matplotlib.pyplot.figure

Figure object.

ax : matplotlib.pyplot.axis

Axis object.


ax : matplotlib.pyplot.axis

Axis object without overlapping xtick labels.


Calculates the number of rows and columns needed to encompass N subplots.

myplotting.plot_cdf(data, ax=None, plot_kwargs={}, return_axis=False)[source]
myplotting.plot_cdf_confint(data, data_error=0, ax=None, plot_kwargs_line={}, plot_kwargs_fill_between={}, return_axis=False, nsim=100, nbins=20, bin_limits=None)[source]

Performs Monte Carlo simulation with data error to calculate the CDF point-wise confidence interval.


data : array-like

Distribution of data.

data_error : float, array-like

Normal error on data. If an array, must have same dimensions as data.

ax : matplotlib.pyplot.axis, optional

If provided, adds plot to axis object. Else plots matplotlib.pyplot.

plot_kwargs_line : dict, optional

Kwargs to provide to matplotlib.pyplot.plot for median CDF.

plot_kwargs_fill_between : dict, optional

Kwargs to provide to matplotlib.pyplot.fill_between for CDF confidence interval.

return_axis : bool, optional

Return the CDF bin values of the data?

nsim : int, optional

Number of Monte Carlo simulations to run.

nbins : int, optional

Number of bins with which to sample the simulated data.

bin_limits : array-like, optional

Lower and upper bound of bins with which to calculate point-wise confidence intervals.


x : array-like, optional

If return_axis is True, then the CDF sample locations for the original dataset is returned.


Reverses a matplolib.colors colormap.


cmap :



cmap_r :

Reversed colormap

myplotting.scatter_contour(x, y, levels=10, fractional_levels=True, threshold=100, log_counts=False, histogram2d_args={}, plot_args={}, errors=None, contour_args={}, ax=None)[source]

Scatter plot with contour over dense regions


x, y : arrays

x and y data for the contour plot

levels : integer or array (optional, default=10)

number of contour levels, or array of contour levels

fractional_levels : bool (optional, default=True)

If True, then levels argument (if array-like) is interpreted as levels within which contain the fraction of data points specified. The threshold and log_counts arguments will not have an effect if True.

threshold : float (default=100)

number of points per 2D bin at which to begin drawing contours

log_counts :boolean (optional)

if True, contour levels are the base-10 logarithm of bin counts.

histogram2d_args : dict

keyword arguments passed to numpy.histogram2d see doc string of numpy.histogram2d for more information

plot_args : dict

keyword arguments passed to pylab.scatter see doc string of pylab.scatter for more information

contourf_args : dict

keyword arguments passed to pylab.contourf see doc string of pylab.contourf for more information

ax : pylab.Axes instance

the axes on which to plot. If not specified, the current axes will be used


level_fractions : numpy.array

Data fraction levels for each contour.

myplotting.set_color_cycle(num_colors=4, cmap=<matplotlib.colors.LinearSegmentedColormap object>, cmap_limits=[0, 0.8])[source]
myplotting.truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100)[source]

Truncates a matplolib.colors colormap to a smaller range.


cmap :


minval : float

Lower value to truncate.

maxval : float

Upper value to truncate

n : int

Number of discrete samples of colormap between minval and maxval.


new_cmap :

Truncated colormap