Skip to content

Commit 11bafd1

Browse files
committed
Merge pull request #57 from adrn/nicer-mpl
Nicer plot defaults
2 parents 4cd9c98 + 5ecb94f commit 11bafd1

7 files changed

Lines changed: 462 additions & 49 deletions

File tree

prepare_deploy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ def walk_through_tutorials(only_published=True, selected_nb_re=None):
5252
for filename in os.listdir(tutorial_path):
5353
base,ext = os.path.splitext(filename)
5454

55-
if ext.lower() == ".ipynb" and "checkpoint" not in base \
56-
and "_run_" not in base:
57-
print(filename)
55+
if ext.lower() == ".ipynb" and "checkpoint" not in base:
5856
full_filename = os.path.join(tutorial_path, filename)
5957
notebook = read(open(full_filename), 'json')
6058
is_published = notebook['metadata']['astropy-tutorials'].get('published', False)

templates/matplotlibrc

Lines changed: 392 additions & 0 deletions
Large diffs are not rendered by default.

tutorials/FITS-header/FITS-header.ipynb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"metadata": {
3-
"astropy-tutorials": {
4-
"author": "Adrian M. Price-Whelan <adrn@astro.columbia.edu>",
5-
"date": "July 2013",
6-
"name": "",
7-
"link_name": "Editing a FITS header",
8-
"published": true
9-
}
3+
"astropy-tutorials": {
4+
"author": "Adrian M. Price-Whelan <adrn@astro.columbia.edu>",
5+
"date": "July 2013",
6+
"link_name": "Editing a FITS header",
7+
"name": "",
8+
"published": true
9+
},
10+
"signature": "sha256:8e988975ce1af1a9c3c8dcb6b30fb5345df782023545c3ddcb0cf58c6ebce148"
1011
},
1112
"nbformat": 3,
1213
"nbformat_minor": 0,
@@ -143,7 +144,7 @@
143144
"cell_type": "code",
144145
"collapsed": false,
145146
"input": [
146-
"fits.writeto('output_file.fits', data, header)"
147+
"fits.writeto('output_file.fits', data, header, clobber=True)"
147148
],
148149
"language": "python",
149150
"metadata": {},

tutorials/FITS-images/FITS-images.ipynb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"metadata": {
3-
"astropy-tutorials": {
4-
"author": "Lia R. Corrales <lia@astro.columbia.edu>",
5-
"date": "January 2014",
6-
"name": "",
7-
"link_name": "Viewing and manipulating FITS images",
8-
"published": true
9-
}
3+
"astropy-tutorials": {
4+
"author": "Lia R. Corrales <lia@astro.columbia.edu>",
5+
"date": "January 2014",
6+
"link_name": "Viewing and manipulating FITS images",
7+
"name": "",
8+
"published": true
9+
},
10+
"signature": "sha256:6730dbab487e985094dbfb0c0ef5cf8308a9c1d0578c38bf873c7ed721a48b67"
1011
},
1112
"nbformat": 3,
1213
"nbformat_minor": 0,
@@ -18,7 +19,13 @@
1819
"collapsed": false,
1920
"input": [
2021
"import numpy as np\n",
21-
"import matplotlib.pyplot as plt"
22+
"\n",
23+
"# Set up matplotlib and use a nicer set of plot parameters\n",
24+
"%config InlineBackend.rc = {}\n",
25+
"import matplotlib\n",
26+
"matplotlib.rc_file(\"../../templates/matplotlibrc\")\n",
27+
"import matplotlib.pyplot as plt\n",
28+
"%matplotlib inline"
2229
],
2330
"language": "python",
2431
"metadata": {},

tutorials/FITS-tables/FITS-tables.ipynb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"metadata": {
3-
"astropy-tutorials": {
4-
"author": "Lia R. Corrales <lia@astro.columbia.edu>",
5-
"date": "January 2014",
6-
"name": "",
7-
"link_name": "Viewing and manipulating data from FITS tables",
8-
"published": true
9-
}
3+
"astropy-tutorials": {
4+
"author": "Lia R. Corrales <lia@astro.columbia.edu>",
5+
"date": "January 2014",
6+
"link_name": "Viewing and manipulating data from FITS tables",
7+
"name": "",
8+
"published": true
9+
},
10+
"signature": "sha256:3460b1474fd246437874a4dc87edfcaf0db23d025a712e58e9b764acfebcca4d"
1011
},
1112
"nbformat": 3,
1213
"nbformat_minor": 0,
@@ -18,7 +19,13 @@
1819
"collapsed": false,
1920
"input": [
2021
"import numpy as np\n",
21-
"import matplotlib.pyplot as plt"
22+
"\n",
23+
"# Set up matplotlib and use a nicer set of plot parameters\n",
24+
"%config InlineBackend.rc = {}\n",
25+
"import matplotlib\n",
26+
"matplotlib.rc_file(\"../../templates/matplotlibrc\")\n",
27+
"import matplotlib.pyplot as plt\n",
28+
"%matplotlib inline"
2229
],
2330
"language": "python",
2431
"metadata": {},

tutorials/Plot-Catalog/plot-catalog.ipynb

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"metadata": {
3-
"astropy-tutorials": {
4-
"author": "Adrian M. Price-Whelan <adrn@astro.columbia.edu>",
5-
"date": "July 2013",
6-
"name": "",
7-
"link_name": "Read and plot catalog information from a text file",
8-
"published": true
9-
}
3+
"astropy-tutorials": {
4+
"author": "Adrian M. Price-Whelan <adrn@astro.columbia.edu>",
5+
"date": "July 2013",
6+
"link_name": "Read and plot catalog information from a text file",
7+
"name": "",
8+
"published": true
9+
},
10+
"signature": "sha256:35165ed415be544e141be609b6b3a438c46a455f00808a1cdda35af3042a373f"
1011
},
1112
"nbformat": 3,
1213
"nbformat_minor": 0,
@@ -17,9 +18,14 @@
1718
"cell_type": "code",
1819
"collapsed": false,
1920
"input": [
20-
"%matplotlib inline\n",
21+
"import numpy as np\n",
22+
"\n",
23+
"# Set up matplotlib and use a nicer set of plot parameters\n",
24+
"%config InlineBackend.rc = {}\n",
25+
"import matplotlib\n",
26+
"matplotlib.rc_file(\"../../templates/matplotlibrc\")\n",
2127
"import matplotlib.pyplot as plt\n",
22-
"import numpy as np\n"
28+
"%matplotlib inline"
2329
],
2430
"language": "python",
2531
"metadata": {},

tutorials/Quantities/Quantities.ipynb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"metadata": {
3-
"astropy-tutorials": {
4-
"author": "Ana Bonaca <ana.bonaca@yale.edu>, Erik Tollerud <erik.tollerud@yale.edu>, Jonathan Foster <jonathan.b.foster@yale.edu>",
5-
"date": "April 2014",
6-
"name": "",
7-
"link_name": "Using Astropy Quantites for astrophysical calculations",
8-
"published": true
9-
}
3+
"astropy-tutorials": {
4+
"author": "Ana Bonaca <ana.bonaca@yale.edu>, Erik Tollerud <erik.tollerud@yale.edu>, Jonathan Foster <jonathan.b.foster@yale.edu>",
5+
"date": "April 2014",
6+
"link_name": "Using Astropy Quantites for astrophysical calculations",
7+
"name": "",
8+
"published": true
9+
},
10+
"signature": "sha256:0b60a6688134ca2541d6d959efb64c1fcb1f59665f6690d041fd4511837f7752"
1011
},
1112
"nbformat": 3,
1213
"nbformat_minor": 0,
@@ -61,12 +62,12 @@
6162
"# It makes the \"random\" number generator always give the same numbers wherever you run it.\n",
6263
"np.random.seed(12345)\n",
6364
"\n",
64-
"# Plotting setup for an ipython notebook\n",
65-
"%matplotlib inline\n",
66-
"fontsize = 18\n",
67-
"plt.rcParams['axes.labelsize'] = fontsize\n",
68-
"plt.rcParams['xtick.labelsize'] = fontsize\n",
69-
"plt.rcParams['ytick.labelsize'] = fontsize"
65+
"# Set up matplotlib and use a nicer set of plot parameters\n",
66+
"%config InlineBackend.rc = {}\n",
67+
"import matplotlib\n",
68+
"matplotlib.rc_file(\"../../templates/matplotlibrc\")\n",
69+
"import matplotlib.pyplot as plt\n",
70+
"%matplotlib inline"
7071
],
7172
"language": "python",
7273
"metadata": {},
@@ -231,6 +232,7 @@
231232
"cell_type": "code",
232233
"collapsed": false,
233234
"input": [
235+
"plt.figure()\n",
234236
"plt.hist(v, bins=20, histtype=\"step\")\n",
235237
"plt.xlabel(\"Velocity (km/s)\")\n",
236238
"plt.ylabel(\"N\")"

0 commit comments

Comments
 (0)