Skip to content

Commit

Permalink
Add summary; spellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
mdpiper committed Aug 1, 2023
1 parent b960d59 commit c189528
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions lessons/python/4a_plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"source": [
"## Read the data\n",
"\n",
"Use the NumPy `loadtxt` function to read the digital elevation dataset. "
"First, use the NumPy `loadtxt` function to read the digital elevation dataset. "
]
},
{
Expand Down Expand Up @@ -126,9 +126,7 @@
"metadata": {},
"source": [
"We can use the function `imshow` within `matplotlib.pyplot` to display an array as a 2D\n",
"image. \n",
"\n",
"Try to display the 2D `topo` array"
"image."
]
},
{
Expand Down Expand Up @@ -168,14 +166,12 @@
"## Plotting, take two\n",
" \n",
"It's hard to get a sense of how the topography changes across the\n",
"landscape from these big tables of numbers. A simpler way to display\n",
"landscape from tables of numbers. A simpler way to display\n",
"this information is with line plots.\n",
"\n",
"We are again going to use the `matplotlib` package for data\n",
"visualization. Since we imported the `matplotlib.pyplot` library once\n",
"already, those tools are available and can be called within Python. As a\n",
"review, though, we are going to write every step needed to load and plot\n",
"the data.\n",
"already, those tools are available and can be called within Python.\n",
"\n",
"We use the function `plot` to create two basic line plots of the\n",
"topography:"
Expand Down Expand Up @@ -245,10 +241,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
" ## Practice your skills: Make your own plots \n",
"## Practice your skills: Make your own plots \n",
"\n",
" Create a single plot showing how the maximum (`numpy.max()`),\n",
" minimum (`numpy.min()`), and mean (`numpy.mean()`) elevation changes with longitude. Label the axes and include a title for each of the plots (Hint: use `axis=0`). Create a legend."
"Create a single plot showing how the maximum, minimum, and mean elevation changes with longitude.\n",
"Label the axes and include a title for each of the plots (Hint: use `axis=0`). Create a legend."
]
},
{
Expand Down Expand Up @@ -302,11 +298,6 @@
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"topo = np.loadtxt(\"data/topo.asc\", delimiter=\",\")\n",
"\n",
"fig = plt.figure(figsize=(16.0, 3.0))\n",
"\n",
"axes1 = fig.add_subplot(1, 3, 1)\n",
Expand Down Expand Up @@ -336,9 +327,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Subplots of DEMs (Takehome) \n",
"## Subplots of DEMs (Take-home) \n",
" \n",
"Make a 4x2 grid of subplots that use the function `imshow` to display each quarter of the dataset (ie. split down the middle in both x and y) in the left column. Plot corresponding profiles going from east to west in center of the image (cfr. Mid) in the right column.\n",
"Make a 4x2 grid of subplots that use the function `imshow` to display each quarter of the dataset (i.e., split down the middle in both x and y) in the left column. Plot corresponding profiles going from east to west in center of the image (cfr. Mid) in the right column.\n",
"\n",
"When plotting the DEMs (left column)\n",
"* Don't label axes or add a colorbar. It can be tricky to do this with subplots.\n",
Expand Down Expand Up @@ -430,11 +421,19 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": []
"source": [
"Data visualization is key for understanding data and for communicating research results.\n",
"We intentionally do not focus on visualization in Ivy\n",
"because many others have done it already,\n",
"and have done it better.\n",
"A wonderful example is the [Matplotlib Examples](https://matplotlib.org/stable/gallery/index.html),\n",
"which holds a gallery of over 100 example visualizations.\n",
"A strategy for using it is to find a plot in the gallery similar to what you want,\n",
"then copying the code provided that generates the plot,\n",
"tailoring it to suit your needs."
]
}
],
"metadata": {
Expand Down

0 comments on commit c189528

Please sign in to comment.