From e354c98029cdbd624ee799383ddddaeede81e58b Mon Sep 17 00:00:00 2001 From: alex-rowden Date: Thu, 13 Feb 2025 07:46:04 -0500 Subject: [PATCH 1/2] modified spacing to conform to Black --- notebooks/01_introduction.ipynb | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/notebooks/01_introduction.ipynb b/notebooks/01_introduction.ipynb index d6a740e..646473b 100644 --- a/notebooks/01_introduction.ipynb +++ b/notebooks/01_introduction.ipynb @@ -72,9 +72,21 @@ "fruits = [\"Apples\", \"Pears\", \"Nectarines\", \"Plums\", \"Grapes\", \"Strawberries\"]\n", "years = [\"2015\", \"2016\", \"2017\"]\n", "\n", - "data = {\"fruits\": fruits, \"2015\": [2, 1, 4, 3, 2, 4], \"2016\": [5, 3, 4, 2, 4, 6], \"2017\": [3, 2, 4, 4, 5, 3]}\n", - "\n", - "p = figure(x_range=fruits, height=250, title=\"Fruit Counts by Year\", toolbar_location=None, tools=\"hover\", tooltips=\"$name @fruits: @$name\")\n", + "data = {\n", + " \"fruits\": fruits,\n", + " \"2015\": [2, 1, 4, 3, 2, 4],\n", + " \"2016\": [5, 3, 4, 2, 4, 6],\n", + " \"2017\": [3, 2, 4, 4, 5, 3]\n", + "}\n", + "\n", + "p = figure(\n", + " x_range=fruits,\n", + " height=250,\n", + " title=\"Fruit Counts by Year\",\n", + " toolbar_location=None,\n", + " tools=\"hover\",\n", + " tooltips=\"$name @fruits: @$name\"\n", + ")\n", "\n", "p.vbar_stack(years, x=\"fruits\", width=0.9, color=HighContrast3, source=data, legend_label=years)\n", "\n", @@ -287,9 +299,9 @@ ], "metadata": { "kernelspec": { - "display_name": "scipy-scipy-interactive-dataviz-bokeh", + "display_name": "bk-tutorial", "language": "python", - "name": "conda-env-scipy-scipy-interactive-dataviz-bokeh-py" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -301,12 +313,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.4" - }, - "vscode": { - "interpreter": { - "hash": "0494a81e5f69860dcb844ce8e12eb9c88a7e813ddbfb0fbade72137f5ce45437" - } + "version": "3.13.1" } }, "nbformat": 4, From ec7edf63add3d18001950ef9a46d12e6fa36f386 Mon Sep 17 00:00:00 2001 From: alex-rowden Date: Sun, 23 Feb 2025 14:16:08 -0500 Subject: [PATCH 2/2] Updated f string and added a small explanation in the note for clarity. --- notebooks/07_annotations.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/07_annotations.ipynb b/notebooks/07_annotations.ipynb index df90c38..d79a154 100644 --- a/notebooks/07_annotations.ipynb +++ b/notebooks/07_annotations.ipynb @@ -541,7 +541,7 @@ "\n", "for i, (xlabel, ylabel) in enumerate(zip([0.5, 1.6, 2.8, 4.2], [0.95, 0.6, 0.5, 0.45])):\n", " p.line(x, jv(i, x), line_width=3, color=PiYG[4][i])\n", - " p.add_layout(Label(text=r\"$$J_\" + str(i) + \"(x)$$\", x=xlabel, y=ylabel))\n", + " p.add_layout(Label(text=rf\"$$J_{i}(x)$$\", x=xlabel, y=ylabel))\n", "\n", "show(p)" ] @@ -554,11 +554,11 @@ "\n", "- Use of standard LaTeX delimeters of ``$$``. Other options are available.\n", "- Use raw Python strings e.g. ``r\"$$\\alpha$$\"`` so that backslashes are interpreted as normal characters rather than control sequences. \n", + " - Raw strings can be used in conjunction with f-strings by using 'rf'.\n", "- ``Div`` and ``Paragraph`` accept LaTeX for just part of their contents, but for all other elements the whole contents must be LaTeX.\n", " - To put normal text in a LaTeX string use ``\\text{...}``.\n", " - We are actively working on improvements in this area.\n", "\n", - "\n", "#### Where can LaTeX be used?" ] },