{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Using data layers to plot points on the surface of planets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook shows how to show data in the WorldWide Telescope Jupyter widget, specifically on the surface of a planet. You can find out more about using pywwt in the [documentation](http://pywwt.readthedocs.io).\n", "\n", "We start off by importing the ``WWTJupyterWidget`` class:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pywwt.jupyter import WWTJupyterWidget" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We then use this class to create the widget (note that the second ``wwt`` is needed to actually show the contents of the widget):" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "wwt = WWTJupyterWidget()\n", "wwt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Once the widget appears, you can then use the ``wwt`` object to change the current view to the Earth:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "wwt.set_view('Earth')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally we load a dataset and add a data layer in WWT:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from astropy.table import Table\n", "EARTHQUAKES = 'https://worldwidetelescope.github.io/pywwt/data/earthquakes_2010.csv'\n", "table = Table.read(EARTHQUAKES, delimiter=',', format='ascii.basic', fast_reader=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "layer = wwt.layers.add_data_layer(table=table, frame='Earth', lon_att='longitude', lat_att='latitude', color='red')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }