Skip to content

Commit

Permalink
Merge pull request #2 from harvardinformatics/2021-01-19_intro_data_s…
Browse files Browse the repository at this point in the history
…cience_1

added matplotlib to requirements
  • Loading branch information
andymbryant authored Jan 19, 2021
2 parents c9984aa + ae6407e commit f092cf0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
1 change: 1 addition & 0 deletions intro_data_science/part_1/binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pandas==1.2.0
matplotlib==3.3.3
21 changes: 21 additions & 0 deletions intro_data_science/part_1/ds_part_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,27 @@
"source": [
"https://jakevdp.github.io/PythonDataScienceHandbook/02.05-computation-on-arrays-broadcasting.html"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Plot sin and cos on the same graph, using matplotlib\n",
"# Compute the x and y coordinates for points on sine and cosine curves \n",
"\n",
"# Set up a subplot grid that has height 2 and width 1, \n",
"# and set the first such subplot as active. \n",
"\n",
"# Make the first plot \n",
" \n",
"# Set the second subplot as active, and make the second plot. \n",
"\n",
"# Ensure tight layout\n",
" \n",
"# Show the figure. "
]
}
],
"metadata": {
Expand Down
30 changes: 28 additions & 2 deletions intro_data_science/part_1/ds_part_1_complete.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"import numpy as np\n",
"from IPython.display import Image\n",
"import time\n",
"from sys import getsizeof"
"from sys import getsizeof\n",
"import matplotlib.pyplot"
]
},
{
Expand Down Expand Up @@ -2404,7 +2405,32 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"# Plot sin and cos on the same graph, using matplotlib\n",
"# Compute the x and y coordinates for points on sine and cosine curves \n",
"x = np.arange(0, 5 * np.pi, 0.1) \n",
"y_sin = np.sin(x) \n",
"y_cos = np.cos(x) \n",
" \n",
"# Set up a subplot grid that has height 2 and width 1, \n",
"# and set the first such subplot as active. \n",
"plt.subplot(2, 1, 1)\n",
" \n",
"# Make the first plot \n",
"plt.plot(x, y_sin) \n",
"plt.title('Sine') \n",
" \n",
"# Set the second subplot as active, and make the second plot. \n",
"plt.subplot(2, 1, 2) \n",
"plt.plot(x, y_cos) \n",
"plt.title('Cosine') \n",
"\n",
"# Ensure tight layout\n",
"plt.tight_layout()\n",
" \n",
"# Show the figure. \n",
"plt.show()"
]
}
],
"metadata": {
Expand Down

0 comments on commit f092cf0

Please sign in to comment.