Skip to content

Commit dd6064a

Browse files
committed
Linted notebook Z
1 parent b247f29 commit dd6064a

1 file changed

Lines changed: 29 additions & 37 deletions

File tree

notes/Z-Libraries_and_Matplotlib_Example.ipynb

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"outputs": [],
3434
"source": [
3535
"import math\n",
36+
"\n",
3637
"number = 2\n",
3738
"math.sqrt(number)"
3839
]
@@ -44,6 +45,7 @@
4445
"outputs": [],
4546
"source": [
4647
"import math as m\n",
48+
"\n",
4749
"m.log(number)"
4850
]
4951
},
@@ -62,24 +64,14 @@
6264
"In most cases, the input to matplotlib plotting functions is arrays of numerical types, floats or integers. "
6365
]
6466
},
65-
{
66-
"cell_type": "code",
67-
"execution_count": null,
68-
"metadata": {},
69-
"outputs": [],
70-
"source": [
71-
"# The code below installs the latest version of numpy and matplotlib\n",
72-
"!sudo -H pip3 install -U numpy\n",
73-
"!sudo -H pip3 install -U matplotlib"
74-
]
75-
},
7667
{
7768
"cell_type": "code",
7869
"execution_count": null,
7970
"metadata": {},
8071
"outputs": [],
8172
"source": [
8273
"import matplotlib\n",
74+
"\n",
8375
"matplotlib.__version__"
8476
]
8577
},
@@ -90,15 +82,15 @@
9082
"outputs": [],
9183
"source": [
9284
"# used to embed plots inside an ipython notebook\n",
93-
"%matplotlib inline \n",
85+
"%matplotlib inline\n",
9486
"import matplotlib.pyplot as plt\n",
9587
"\n",
9688
"# really simple example:\n",
97-
"y = [1,2,3,4,5,4,3,2,1]\n",
98-
"x = [1,2,3,4,5,6,7,8,9]\n",
89+
"y = [1, 2, 3, 4, 5, 4, 3, 2, 1]\n",
90+
"x = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
9991
"plt.plot(x, y)\n",
100-
"plt.plot([1,2,3,4])\n",
101-
"plt.ylabel('some numbers')\n",
92+
"plt.plot([1, 2, 3, 4])\n",
93+
"plt.ylabel(\"some numbers\")\n",
10294
"plt.show()"
10395
]
10496
},
@@ -110,7 +102,7 @@
110102
"source": [
111103
"import numpy as np\n",
112104
"\n",
113-
"X = np.linspace(0, 10, 101) #create values from 0 to 10, and use 101 values\n",
105+
"X = np.linspace(0, 10, 101) # create values from 0 to 10, and use 101 values\n",
114106
"X"
115107
]
116108
},
@@ -123,17 +115,17 @@
123115
"import numpy as np\n",
124116
"import math as math\n",
125117
"\n",
126-
"X = np.linspace(0, 10, 100001) #create values from 0 to 10, and use 10001 values\n",
118+
"X = np.linspace(0, 10, 100001) # create values from 0 to 10, and use 10001 values\n",
127119
"Y = []\n",
128120
"\n",
129121
"for x in X:\n",
130122
" y = math.sin(x)\n",
131123
" Y.append(y)\n",
132-
" \n",
133-
"plt.plot(X, Y, 'mx')\n",
134-
"plt.title('The Sine Wave')\n",
135-
"plt.xlabel('X')\n",
136-
"plt.ylabel('sin(X)')"
124+
"\n",
125+
"plt.plot(X, Y, \"mx\")\n",
126+
"plt.title(\"The Sine Wave\")\n",
127+
"plt.xlabel(\"X\")\n",
128+
"plt.ylabel(\"sin(X)\")"
137129
]
138130
},
139131
{
@@ -194,11 +186,11 @@
194186
"source": [
195187
"Y = []\n",
196188
"for x in X:\n",
197-
" y = [math.sin(x), math.cos(x), 0.1*x]\n",
189+
" y = [math.sin(x), math.cos(x), 0.1 * x]\n",
198190
" Y.append(y)\n",
199191
"\n",
200192
"plt.plot(X, Y)\n",
201-
"plt.legend(['sin(x)', 'cos(x)', 'x/10'])"
193+
"plt.legend([\"sin(x)\", \"cos(x)\", \"x/10\"])"
202194
]
203195
},
204196
{
@@ -215,9 +207,9 @@
215207
"outputs": [],
216208
"source": [
217209
"plt.plot(Y)\n",
218-
"plt.xlabel('index')\n",
219-
"plt.ylabel('f(x)')\n",
220-
"plt.legend(['sin(x)', 'cos(x)', 'x/10'])"
210+
"plt.xlabel(\"index\")\n",
211+
"plt.ylabel(\"f(x)\")\n",
212+
"plt.legend([\"sin(x)\", \"cos(x)\", \"x/10\"])"
221213
]
222214
},
223215
{
@@ -238,10 +230,10 @@
238230
"for x in X:\n",
239231
" Y.append(math.sin(x))\n",
240232
" Z.append(math.cos(x))\n",
241-
" \n",
242-
"plt.plot(X, Y, 'b-.')\n",
243-
"plt.plot(X, Z, 'r--')\n",
244-
"plt.legend(['sin(x)', 'cos(x)'])"
233+
"\n",
234+
"plt.plot(X, Y, \"b-.\")\n",
235+
"plt.plot(X, Z, \"r--\")\n",
236+
"plt.legend([\"sin(x)\", \"cos(x)\"])"
245237
]
246238
},
247239
{
@@ -261,7 +253,7 @@
261253
"source": [
262254
"vals = [7, 6.2, 3, 5, 9]\n",
263255
"xval = [1, 2, 3, 4, 5]\n",
264-
"plt.bar(xval, vals)\n"
256+
"plt.bar(xval, vals)"
265257
]
266258
},
267259
{
@@ -280,9 +272,9 @@
280272
"outputs": [],
281273
"source": [
282274
"Y = []\n",
283-
"for x in range(0,100000):\n",
275+
"for x in range(0, 100000):\n",
284276
" Y.append(np.random.randn())\n",
285-
" \n",
277+
"\n",
286278
"plt.hist(Y, 50)"
287279
]
288280
},
@@ -310,9 +302,9 @@
310302
"name": "python",
311303
"nbconvert_exporter": "python",
312304
"pygments_lexer": "ipython3",
313-
"version": "3.5.2"
305+
"version": "3.8.2"
314306
}
315307
},
316308
"nbformat": 4,
317-
"nbformat_minor": 0
309+
"nbformat_minor": 1
318310
}

0 commit comments

Comments
 (0)