Visualizing the NASA Exoplanet Archive¶

In this notebook, we will visualize the table of confirmed exoplanets from the NASA Exoplanet Archive (as of 30th September 2019), and we will take a look at some of the more advanced features of tabular data visualization.

In [ ]:
import os
from astropy.table import Table



and we take a look at the first five rows to familiarize ourselves with the data:

In [ ]:
exoplanets[:5]


Step 2: Setting up WWT¶

First, we need to connect to the WWT app. If WWT isn't running yet, activate the JupyterLab command palette from the View menu, and select "AAS WorldWide Telescope". Then all we need to do is run:

In [ ]:
from pywwt.jupyter import connect_to_app


Now the wwt variable will let us talk to the WWT app.

Step 3: Adding a tabular data layer¶

We are now ready to add the data to WWT. We start off by calling add_table_layer to create the layer:

In [ ]:
layer = wwt.layers.add_table_layer(exoplanets)


By default the points are quite small, so we can enlarge them:

In [ ]:
layer.size_scale = 50


You should now see points appear in the widget above. Have a look around and see what the distribution of these confirmed exoplanets is on the sky. For example, you can use the following to point the view at the Kepler field:

In [ ]:
from astropy import units as u
from astropy.coordinates import SkyCoord
wwt.center_on_coordinates(SkyCoord(76.32, 13.5, unit='deg', frame='galactic'), fov=20 * u.deg)


Color-coding and scaling of points by attributes¶

All the points are currently white, but you can also choose to color code points by one of the other attributes. For example, we can color code the points by effective temperature of the parent star:

In [ ]:
layer.cmap_att = 'st_teff'


The cmap_vmin and cmap_vmax properties can be used to specify which values should be used as the extremes for the colorbar:

In [ ]:
layer.cmap_vmin = 5000
layer.cmap_vmax = 8000


and finally the colormap can be set using the cmap attribute, which takes either the name of a Matplotlib colormap or a Matplotlib colormap object:

In [ ]:
layer.cmap = 'RdYlBu'


We can also scale the size of the points by one of the attributes — for example by the mass of the planet, and similarly we can set lower and upper values for the scaling:

In [ ]:
layer.size_att = 'pl_bmassj'
layer.size_vmin = 0
layer.size_vmax = 30


Visualizing the data in 3D¶

Luckily, the exoplanet catalog contains Gaia distances to most of the planetary systems, so we can now tell the layer about the third dimension:

In [ ]:
layer.alt_att = 'gaia_dist'
layer.alt_type = 'distance'


Finally we can switch PyWWT to 3D mode and explore the spatial distribution of the systems:

In [ ]:
wwt.set_view('solar system')


Start zooming out, with a two finger scroll, using your mouse wheel, or by pressing 'x'. Some of the larger points dominate the view, so we can turn off the scaling by size:

In [ ]:
layer.size_att = ''


Keep on zooming out until you can see (an artist’s rendering of) the plane of the Milky Way. At this point, you should see a cone of systems which corresponds to those discovered in the original Kepler field!

You may notice that some points appear and disappear as you rotate around. To avoid this effect, set the following option:

In [ ]:
layer.far_side_visible = True


When this option is False (the default), points on the other side of the Sun (or the reference object being used for plotting) are hidden — this is useful when plotting on e.g. planets and the Sun, but not when looking at this kind of data.

What's Next¶

To see how to plot a data table that contains a time axis, check out the GRBs Over Time tutorial.

Credits¶

This notebook was prepared by Thomas Robitaille.