|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "metadata": { |
| 7 | + "ExecuteTime": { |
| 8 | + "end_time": "2020-04-23T18:26:07.447844Z", |
| 9 | + "start_time": "2020-04-23T18:26:07.441869Z" |
| 10 | + } |
| 11 | + }, |
| 12 | + "outputs": [], |
| 13 | + "source": [ |
| 14 | + "# import plotly graph objects\n", |
| 15 | + "import plotly.graph_objs as go\n", |
| 16 | + "\n", |
| 17 | + "# import pandas\n", |
| 18 | + "import pandas as pd" |
| 19 | + ] |
| 20 | + }, |
| 21 | + { |
| 22 | + "cell_type": "markdown", |
| 23 | + "metadata": {}, |
| 24 | + "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)" |
| 28 | + ] |
| 29 | + }, |
| 30 | + { |
| 31 | + "cell_type": "code", |
| 32 | + "execution_count": null, |
| 33 | + "metadata": { |
| 34 | + "ExecuteTime": { |
| 35 | + "end_time": "2020-04-23T18:26:07.909854Z", |
| 36 | + "start_time": "2020-04-23T18:26:07.906289Z" |
| 37 | + } |
| 38 | + }, |
| 39 | + "outputs": [], |
| 40 | + "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 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "markdown", |
| 56 | + "metadata": {}, |
| 57 | + "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." |
| 60 | + ] |
| 61 | + }, |
| 62 | + { |
| 63 | + "cell_type": "code", |
| 64 | + "execution_count": null, |
| 65 | + "metadata": { |
| 66 | + "ExecuteTime": { |
| 67 | + "end_time": "2020-04-23T18:26:08.379200Z", |
| 68 | + "start_time": "2020-04-23T18:26:08.282163Z" |
| 69 | + } |
| 70 | + }, |
| 71 | + "outputs": [], |
| 72 | + "source": [ |
| 73 | + "# load data\n", |
| 74 | + "df = pd.read_csv('https://raw.githubusercontent.com/Pierian-Data/Plotly-Dashboards-with-Dash/master/Data/mocksurvey.csv',index_col=0)" |
| 75 | + ] |
| 76 | + }, |
| 77 | + { |
| 78 | + "cell_type": "code", |
| 79 | + "execution_count": null, |
| 80 | + "metadata": { |
| 81 | + "ExecuteTime": { |
| 82 | + "end_time": "2020-04-23T18:26:08.487873Z", |
| 83 | + "start_time": "2020-04-23T18:26:08.483109Z" |
| 84 | + } |
| 85 | + }, |
| 86 | + "outputs": [], |
| 87 | + "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" |
| 100 | + ] |
| 101 | + }, |
| 102 | + { |
| 103 | + "cell_type": "markdown", |
| 104 | + "metadata": {}, |
| 105 | + "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" |
| 107 | + ] |
| 108 | + }, |
| 109 | + { |
| 110 | + "cell_type": "code", |
| 111 | + "execution_count": null, |
| 112 | + "metadata": { |
| 113 | + "ExecuteTime": { |
| 114 | + "end_time": "2020-04-23T18:26:09.057134Z", |
| 115 | + "start_time": "2020-04-23T18:26:08.854545Z" |
| 116 | + } |
| 117 | + }, |
| 118 | + "outputs": [], |
| 119 | + "source": [ |
| 120 | + "# load data\n", |
| 121 | + "df = pd.read_csv('https://raw.githubusercontent.com/Pierian-Data/Plotly-Dashboards-with-Dash/master/Data/abalone.csv')" |
| 122 | + ] |
| 123 | + }, |
| 124 | + { |
| 125 | + "cell_type": "code", |
| 126 | + "execution_count": null, |
| 127 | + "metadata": { |
| 128 | + "ExecuteTime": { |
| 129 | + "end_time": "2020-04-23T18:26:09.105535Z", |
| 130 | + "start_time": "2020-04-23T18:26:09.099657Z" |
| 131 | + } |
| 132 | + }, |
| 133 | + "outputs": [], |
| 134 | + "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" |
| 146 | + ] |
| 147 | + }, |
| 148 | + { |
| 149 | + "cell_type": "code", |
| 150 | + "execution_count": null, |
| 151 | + "metadata": {}, |
| 152 | + "outputs": [], |
| 153 | + "source": [] |
| 154 | + }, |
| 155 | + { |
| 156 | + "cell_type": "code", |
| 157 | + "execution_count": null, |
| 158 | + "metadata": {}, |
| 159 | + "outputs": [], |
| 160 | + "source": [] |
| 161 | + }, |
| 162 | + { |
| 163 | + "cell_type": "code", |
| 164 | + "execution_count": null, |
| 165 | + "metadata": {}, |
| 166 | + "outputs": [], |
| 167 | + "source": [] |
| 168 | + }, |
| 169 | + { |
| 170 | + "cell_type": "code", |
| 171 | + "execution_count": null, |
| 172 | + "metadata": {}, |
| 173 | + "outputs": [], |
| 174 | + "source": [] |
| 175 | + } |
| 176 | + ], |
| 177 | + "metadata": { |
| 178 | + "kernelspec": { |
| 179 | + "display_name": "Python 3", |
| 180 | + "language": "python", |
| 181 | + "name": "python3" |
| 182 | + }, |
| 183 | + "language_info": { |
| 184 | + "codemirror_mode": { |
| 185 | + "name": "ipython", |
| 186 | + "version": 3 |
| 187 | + }, |
| 188 | + "file_extension": ".py", |
| 189 | + "mimetype": "text/x-python", |
| 190 | + "name": "python", |
| 191 | + "nbconvert_exporter": "python", |
| 192 | + "pygments_lexer": "ipython3", |
| 193 | + "version": "3.7.4" |
| 194 | + }, |
| 195 | + "toc": { |
| 196 | + "base_numbering": 1, |
| 197 | + "nav_menu": {}, |
| 198 | + "number_sections": true, |
| 199 | + "sideBar": true, |
| 200 | + "skip_h1_title": false, |
| 201 | + "title_cell": "Table of Contents", |
| 202 | + "title_sidebar": "Contents", |
| 203 | + "toc_cell": false, |
| 204 | + "toc_position": {}, |
| 205 | + "toc_section_display": true, |
| 206 | + "toc_window_display": false |
| 207 | + }, |
| 208 | + "varInspector": { |
| 209 | + "cols": { |
| 210 | + "lenName": 16, |
| 211 | + "lenType": 16, |
| 212 | + "lenVar": 40 |
| 213 | + }, |
| 214 | + "kernels_config": { |
| 215 | + "python": { |
| 216 | + "delete_cmd_postfix": "", |
| 217 | + "delete_cmd_prefix": "del ", |
| 218 | + "library": "var_list.py", |
| 219 | + "varRefreshCmd": "print(var_dic_list())" |
| 220 | + }, |
| 221 | + "r": { |
| 222 | + "delete_cmd_postfix": ") ", |
| 223 | + "delete_cmd_prefix": "rm(", |
| 224 | + "library": "var_list.r", |
| 225 | + "varRefreshCmd": "cat(var_dic_list()) " |
| 226 | + } |
| 227 | + }, |
| 228 | + "types_to_exclude": [ |
| 229 | + "module", |
| 230 | + "function", |
| 231 | + "builtin_function_or_method", |
| 232 | + "instance", |
| 233 | + "_Feature" |
| 234 | + ], |
| 235 | + "window_display": false |
| 236 | + } |
| 237 | + }, |
| 238 | + "nbformat": 4, |
| 239 | + "nbformat_minor": 2 |
| 240 | +} |
0 commit comments