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.
import os from astropy.table import Table exoplanets = Table.read(os.path.join('data', 'planets_2019.09.30_16.25.03.votable'))
and we take a look at the first five rows to familiarize ourselves with the data:
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:
from pywwt.jupyter import connect_to_app wwt = await connect_to_app().becomes_ready()
wwt variable will let us talk to the WWT app.
We are now ready to add the data to WWT. We start off by calling
add_table_layer to create the layer:
layer = wwt.layers.add_table_layer(exoplanets)
By default the points are quite small, so we can enlarge them:
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:
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)
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:
layer.cmap_att = 'st_teff'
cmap_vmax properties can be used to specify which values should be used as the extremes for the colorbar:
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:
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:
layer.size_att = 'pl_bmassj' layer.size_vmin = 0 layer.size_vmax = 30
Luckily, the exoplanet catalog contains Gaia distances to most of the planetary systems, so we can now tell the layer about the third dimension:
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:
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:
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:
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.