Skip to content
Ryan Varley edited this page Mar 21, 2014 · 2 revisions

OECPy now has a plotting module to make it easy to generate plots of the planet population. By default when requesting a value (ie planet temperature) if the value is absent from the catalogue OECPy will attempt to calculate it and this will be shown in your plot. To disable this behavior add the line oecpy.params.estimateMissingValues = False before you create the plots.

Listed here is a brief tutorial for using the plotting functions in OECPy, I intend to finish and release the full documentation and examples soon. As we are in Beta the syntax is a little inconsistent, expect this to change before the first release

Types of Plot

Currently you can either plot a scatter of planet parameters or plot bins to your requirements. For all types of figure you can get the matplotlib figure and axis objects using by getting the .fig and .ax variables from the class. you can then change the plots to your requirements.

Before we start, run the following code

import oecpy
import quantities as pq
import oecpy.astroquantities as aq

databaseLocation = 'open-exoplanet-catalogue-atmospheres/systems/' # your path here
exocat = oecpy.OECDatabase(databaseLocation)

Scatter Plots

Scatter plots are currently initialised by oecpy.plots.GeneralPlotter, you need to give it the list of astro objects you want to use (currently only planets or stars). This list could have been predicted by you, to include only transiting planets, systems not in binaries or by any criteria you wish - the plotter just works with the list given to it.

Syntax

GeneralPlotter(objectList, xaxis=None, yaxis=None, xunit=None, yunit=None, xaxislog=False, yaxislog=False, size='small')

  • objectList is the list of planets or stars you want to plot,
  • xaxis and yaxis are the parameters you want to use. i.e for radius normally accessed by planet.R it would be 'R'.
  • xunit and yunit and the units to scale the axis to, i.e. aq.R_j for Jupiter radius, aq.R_e for earth radius
  • xaxislog and yaxislog will set their scales to logscale
  • size is either 'small' for normal plots - for documents or 'large' for presentations)

you can call set_marker_color and set_marker_size on the class to change these properties.

** to plot the figure call the .plot() function on the class **

Examples

Planet Mass with Planet Radius

oecpy.plots.GeneralPlotter(exocat.planets, 'R', 'M', yaxislog=True).plot()

Planet Mass with Planet Radius

Stellar V Magnitude with Planet Radius

oecpy.plots.GeneralPlotter(exocat.planets, 'R', 'star.magV',
                            xunit=aq.R_e, xaxislog=True).plot()

Stellar V Magnitude with Planet Radius

Binned Plots

These plots let you plot parameters as binned values with the number of planets on the y axis.

Syntax

DataPerParameterBin(objectList, planetProperty, binLimits, unit=None, size='small')
  • objectList is the list of planets or stars you want to plot,
  • binLimits - a list or tuple of the bin edges (see below)
  • planetProperty (like the xaxis and yaxis in GeneralPlot)
  • unit (like the xunit and yunit in GeneralPlot)
  • size is either 'small' for normal plots - for documents or 'large' for presentations)

binLimits sets what sizes the bins are, you should give the limit of each bin using float('inf') and -float('inf') to set less than and greater than bins.

** to plot the figure call the .plotBarChart() function on the class ** - this function has the additional variables title='', xlabel=None, c='#3ea0e4', label_rotation=False

Examples

Planet Eccentricity

oecpy.plots.DataPerParameterBin(exocat.planets, 'e',
      (0, 0, 0.05, 0.1, 0.2, 0.4, float('inf'))).plotBarChart(label_rotation=45)

Planet Eccentricity

You can also make plots large (ie for presentations), and change the color easily

oecpy.plots.DataPerParameterBin(exocat.planets, 'M',
    (0, 0.2, 0.5, 1, 2, 3, 6, 12, float('inf')), size='large').plotBarChart(c='r')

Planet Eccentricity