mirror of
https://github.com/AllenDowney/AstronomicalData.git
synced 2025-12-22 07:10:38 -08:00
Update documentation
This commit is contained in:
@@ -38,36 +38,6 @@
|
||||
"* Generate a figure with multiple subplots."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"## Installing libraries\n",
|
||||
"\n",
|
||||
"If you are running this notebook on Colab, you can run the following cell to install the libraries we'll use.\n",
|
||||
"\n",
|
||||
"If you are running this notebook on your own computer, you might have to install these libraries yourself. See the instructions in the preface."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# If we're running on Colab, install libraries\n",
|
||||
"\n",
|
||||
"import sys\n",
|
||||
"IN_COLAB = 'google.colab' in sys.modules\n",
|
||||
"\n",
|
||||
"if IN_COLAB:\n",
|
||||
" !pip install wget"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@@ -113,7 +83,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 30,
|
||||
"metadata": {
|
||||
"tags": [
|
||||
"hide-cell"
|
||||
@@ -130,39 +100,50 @@
|
||||
"source": [
|
||||
"## Plotting GD-1\n",
|
||||
"\n",
|
||||
"Let's start with the panel in the lower left. The following cell reloads the data."
|
||||
"Let's start with the panel in the lower left. You can [download the data from the previous lesson](https://github.com/AllenDowney/AstronomicalData/raw/main/data/gd1_data.hdf) or run the following cell, which downloads it if necessary."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 31,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"from wget import download\n",
|
||||
"from os.path import basename, exists\n",
|
||||
"\n",
|
||||
"filename = 'gd1_data.hdf'\n",
|
||||
"path = 'https://github.com/AllenDowney/AstronomicalData/raw/main/data/'\n",
|
||||
"def download(url):\n",
|
||||
" filename = basename(url)\n",
|
||||
" if not exists(filename):\n",
|
||||
" from urllib.request import urlretrieve\n",
|
||||
" local, _ = urlretrieve(url, filename)\n",
|
||||
" print('Downloaded ' + local)\n",
|
||||
"\n",
|
||||
"if not os.path.exists(filename):\n",
|
||||
" print(download(path+filename))"
|
||||
"download('https://github.com/AllenDowney/AstronomicalData/raw/main/' +\n",
|
||||
" 'data/gd1_data.hdf')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now we can reload `winner_df`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 32,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"filename = 'gd1_data.hdf'\n",
|
||||
"winner_df = pd.read_hdf(filename, 'winner_df')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 33,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -190,7 +171,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 34,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -232,7 +213,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 35,
|
||||
"metadata": {
|
||||
"tags": [
|
||||
"hide-cell"
|
||||
@@ -286,7 +267,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 36,
|
||||
"metadata": {
|
||||
"tags": [
|
||||
"hide-cell"
|
||||
@@ -310,7 +291,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 37,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -326,7 +307,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 38,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -364,7 +345,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 39,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -411,23 +392,17 @@
|
||||
"source": [
|
||||
"If you can't find a style sheet that's exactly what you want, you can make your own. This repository includes a style sheet called `az-paper-twocol.mplstyle`, with customizations chosen by Azalee Bostroem for publication in astronomy journals.\n",
|
||||
"\n",
|
||||
"The following cell downloads the style sheet."
|
||||
"You can [download the style sheet](https://github.com/AllenDowney/AstronomicalData/raw/main/az-paper-twocol.mplstyle) or run the following cell, which downloads it if necessary."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 40,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"from wget import download\n",
|
||||
"\n",
|
||||
"filename = 'az-paper-twocol.mplstyle'\n",
|
||||
"path = 'https://github.com/AllenDowney/AstronomicalData/raw/main/'\n",
|
||||
"\n",
|
||||
"if not os.path.exists(filename):\n",
|
||||
" print(download(path+filename))"
|
||||
"download('https://github.com/AllenDowney/AstronomicalData/raw/main/' +\n",
|
||||
" 'az-paper-twocol.mplstyle')"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -495,7 +470,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 41,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -523,7 +498,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 42,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -563,7 +538,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 43,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -580,7 +555,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 44,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -604,7 +579,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 45,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -623,7 +598,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 46,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -657,7 +632,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 47,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -675,7 +650,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 48,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -692,7 +667,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 49,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -718,7 +693,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 50,
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
@@ -738,7 +713,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": 51,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -771,7 +746,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"execution_count": 52,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -787,7 +762,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": 53,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -809,7 +784,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": 54,
|
||||
"metadata": {
|
||||
"tags": [
|
||||
"hide-cell"
|
||||
@@ -841,7 +816,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"execution_count": 55,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -892,7 +867,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"execution_count": 56,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -935,7 +910,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"execution_count": 57,
|
||||
"metadata": {
|
||||
"tags": [
|
||||
"hide-cell"
|
||||
@@ -965,7 +940,7 @@
|
||||
"\n",
|
||||
"* The most effective figures focus on telling a single story clearly and compellingly.\n",
|
||||
"\n",
|
||||
"* Consider using annotations to guide the readers attention to the most important elements of a figure.\n",
|
||||
"* Consider using annotations to guide the reader's attention to the most important elements of a figure.\n",
|
||||
"\n",
|
||||
"* The default Matplotlib style generates good quality figures, but there are several ways you can override the defaults.\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user