|
1 | 1 | {
|
2 | 2 | "cells": [
|
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "## Plotly Assignment\n", |
| 8 | + "\n", |
| 9 | + "**Note**: For some of you, plotly go does not display at all in Jupyter Labs. It is a known bug with plotly. If you are using Jupyter Labs for this assignment and the plots are not showing, please switch to Jupyter Notebooks or Google Collab to complete this exercise. " |
| 10 | + ] |
| 11 | + }, |
3 | 12 | {
|
4 | 13 | "cell_type": "code",
|
5 | 14 | "execution_count": null,
|
|
22 | 31 | "cell_type": "markdown",
|
23 | 32 | "metadata": {},
|
24 | 33 | "source": [
|
25 |
| - "# Objective: Create a scatterplot of 1000 random data points. \n", |
26 |
| - "x-axis values should come from a normal distribution using np.random.randn(1000). \n", |
27 |
| - "y-axis values should come from a uniform distribution over [0,1) using np.random.rand(1000)" |
| 34 | + "### Task 1: Create a scatterplot with a 1000 random data points. \n", |
| 35 | + "\n", |
| 36 | + "- x-axis values should come from a normal distribution using np.random.randn(1000)\n", |
| 37 | + "\n", |
| 38 | + "- y-axis values should come from a uniform distribution over [0,1) using np.random.rand(1000)" |
28 | 39 | ]
|
29 | 40 | },
|
30 | 41 | {
|
|
38 | 49 | },
|
39 | 50 | "outputs": [],
|
40 | 51 | "source": [
|
41 |
| - "# obtain x and y values:\n", |
42 |
| - "\n", |
43 |
| - "\n", |
44 |
| - "\n", |
45 |
| - "# define a data variable\n", |
46 |
| - "\n", |
47 |
| - "\n", |
48 |
| - "# define the layout, and include a title and axis labels\n", |
49 |
| - "\n", |
50 |
| - "\n", |
51 |
| - "# Create a fig from data and layout, and plot the fig\n" |
| 52 | + "# obtain the x and y values:\n" |
| 53 | + ] |
| 54 | + }, |
| 55 | + { |
| 56 | + "cell_type": "code", |
| 57 | + "execution_count": null, |
| 58 | + "metadata": {}, |
| 59 | + "outputs": [], |
| 60 | + "source": [ |
| 61 | + "# define a data variable\n" |
| 62 | + ] |
| 63 | + }, |
| 64 | + { |
| 65 | + "cell_type": "code", |
| 66 | + "execution_count": null, |
| 67 | + "metadata": {}, |
| 68 | + "outputs": [], |
| 69 | + "source": [ |
| 70 | + "# define the layout, include a title and axis labels\n" |
| 71 | + ] |
| 72 | + }, |
| 73 | + { |
| 74 | + "cell_type": "code", |
| 75 | + "execution_count": null, |
| 76 | + "metadata": {}, |
| 77 | + "outputs": [], |
| 78 | + "source": [ |
| 79 | + "# Create a fig from the data and layout. Then plot the fig\n" |
52 | 80 | ]
|
53 | 81 | },
|
54 | 82 | {
|
55 | 83 | "cell_type": "markdown",
|
56 | 84 | "metadata": {},
|
57 | 85 | "source": [
|
58 |
| - "# Objective: Create a stacked bar chart. Note that questions appear in the index (and should be used for the x-axis), while responses appear as column labels. \n", |
59 |
| - "Extra Credit: make a horizontal bar chart! See https://plot.ly/python/horizontal-bar-charts/ for extra credit help." |
| 86 | + "-------------\n", |
| 87 | + "### Task 2: Create a stacked bar chart with the data in the link below. \n", |
| 88 | + "\n", |
| 89 | + "**Note** that the questions appear in the index and should be used for the x-axis, while the responses appear as column labels. \n", |
| 90 | + "\n", |
| 91 | + "Stretch Task: Create a horizontal bar chart! Use this documentation [here](https://plot.ly/python/horizontal-bar-charts/) for help." |
60 | 92 | ]
|
61 | 93 | },
|
62 | 94 | {
|
|
85 | 117 | },
|
86 | 118 | "outputs": [],
|
87 | 119 | "source": [
|
88 |
| - "# create traces using a list comprehension:\n", |
89 |
| - "\n", |
90 |
| - "\n", |
91 |
| - "\n", |
92 |
| - "# create a layout, remember to set the barmode here\n", |
93 |
| - "\n", |
94 |
| - "\n", |
95 |
| - "\n", |
96 |
| - "\n", |
97 |
| - "# create a fig from data & layout, and plot the fig.\n", |
98 |
| - "\n", |
99 |
| - "\n" |
| 120 | + "# create traces using a list comprehension:\n" |
| 121 | + ] |
| 122 | + }, |
| 123 | + { |
| 124 | + "cell_type": "code", |
| 125 | + "execution_count": null, |
| 126 | + "metadata": {}, |
| 127 | + "outputs": [], |
| 128 | + "source": [ |
| 129 | + "# create a layout, remember to set the barmode here\n" |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "cell_type": "code", |
| 134 | + "execution_count": null, |
| 135 | + "metadata": {}, |
| 136 | + "outputs": [], |
| 137 | + "source": [ |
| 138 | + "# create a fig from data & layout, and plot the fig.\n" |
100 | 139 | ]
|
101 | 140 | },
|
102 | 141 | {
|
103 | 142 | "cell_type": "markdown",
|
104 | 143 | "metadata": {},
|
105 | 144 | "source": [
|
106 |
| - "# Objective: Create a histogram that plots the 'length' field from dataset. Set the range from 0 to 1, with a bin size of 0.02" |
| 145 | + "-------------\n", |
| 146 | + "### Task 3: Create a histogram that plots the `length` field from dataset below. Set the range from 0 to 1, with a bin size of 0.02." |
107 | 147 | ]
|
108 | 148 | },
|
109 | 149 | {
|
|
132 | 172 | },
|
133 | 173 | "outputs": [],
|
134 | 174 | "source": [
|
135 |
| - "# create a data variable:\n", |
136 |
| - "\n", |
137 |
| - "\n", |
138 |
| - "\n", |
139 |
| - "# add a layout\n", |
140 |
| - "\n", |
141 |
| - "\n", |
142 |
| - "\n", |
143 |
| - "\n", |
144 |
| - "# create a fig from data & layout, and plot the fig\n", |
145 |
| - "\n" |
| 175 | + "# create a data variable:\n" |
146 | 176 | ]
|
147 | 177 | },
|
148 | 178 | {
|
149 | 179 | "cell_type": "code",
|
150 | 180 | "execution_count": null,
|
151 | 181 | "metadata": {},
|
152 | 182 | "outputs": [],
|
153 |
| - "source": [] |
| 183 | + "source": [ |
| 184 | + "# add a layout\n" |
| 185 | + ] |
154 | 186 | },
|
155 | 187 | {
|
156 | 188 | "cell_type": "code",
|
157 | 189 | "execution_count": null,
|
158 | 190 | "metadata": {},
|
159 | 191 | "outputs": [],
|
160 |
| - "source": [] |
| 192 | + "source": [ |
| 193 | + "# create a fig from data & layout, and plot the fig\n" |
| 194 | + ] |
161 | 195 | },
|
162 | 196 | {
|
163 | 197 | "cell_type": "code",
|
|
190 | 224 | "name": "python",
|
191 | 225 | "nbconvert_exporter": "python",
|
192 | 226 | "pygments_lexer": "ipython3",
|
193 |
| - "version": "3.7.4" |
| 227 | + "version": "3.7.9" |
194 | 228 | },
|
195 | 229 | "toc": {
|
196 | 230 | "base_numbering": 1,
|
|
236 | 270 | }
|
237 | 271 | },
|
238 | 272 | "nbformat": 4,
|
239 |
| - "nbformat_minor": 2 |
| 273 | + "nbformat_minor": 4 |
240 | 274 | }
|
0 commit comments