Visualizing data

These methods are intended for quickly visualizing data. They are not intended for producing publication-quality figures.

c2raytools.plotting.plot_hist(data, logscale=False, **kwargs)

Plot a histogram of the data in a data cube.

Parameters:
  • data (XfracFile, DensityFile, string or numpy array): the data to

    plot. The function will try to determine what type of data it’s been given.

  • logscale = False (bool): whether to plot the logarithm of the data

Kwargs:
All kwargs are sent to matplotlib’s hist function. Here, you can specify, for example, the bins keyword
Returns:
Nothing.
c2raytools.plotting.plot_slice(data, los_axis=0, slice_num=0, logscale=False, **kwargs)

Plot a slice through a data cube. This function will produce a nicely formatted image plot with the correct units on the axes.

Parameters:
  • data (XfracFile, DensityFile, string or numpy array): the data to

    plot. The function will try to determine what type of data it’s been given.

  • los_axis = 0 (integer): the line of sight axis. Must be 0,1 or 2

  • slice_num = 0 (integer): the point along los_axis where the slice

    will be taken.

  • logscale = False (bool): whether to plot the logarithm of the data

Kwargs:
All kwargs are sent to matplotlib’s imshow function. This can be used to, for instance, change the colormap.
Returns:
Nothing.
Example (plot an xfrac file with a custom color map):
>>> xfile = c2t.XfracFile('xfrac3d_8.515.bin')
>>> c2t.plot_slice(xfile, cmap = pl.cmap.hot)

Previous topic

File classes

Next topic

Various analysis functions

This Page