diff --git a/examples/concepts.ipynb b/examples/concepts.ipynb index 4f90d34..7e24d62 100644 --- a/examples/concepts.ipynb +++ b/examples/concepts.ipynb @@ -429,13 +429,13 @@ "fig.suptitle(\"A composed plot\")\n", "\n", "for i, p in enumerate(\"xy\"):\n", - " for dat in (data, data2):\n", + " for j, dat in enumerate((data, data2)):\n", " plot = xplt.ParticleHistogramPlot(\n", " p,\n", " dat,\n", " \"count,cumulative\",\n", " ax=axs[:, i],\n", - " plot_kwargs=dict(label=dat.label),\n", + " plot_kwargs=dict(label=dat.label, ls=f\"-{j}\"), # customization\n", " )\n", " if i == 0:\n", " break\n", diff --git a/examples/timestructure.ipynb b/examples/timestructure.ipynb index 28e2660..fa4218c 100644 --- a/examples/timestructure.ipynb +++ b/examples/timestructure.ipynb @@ -699,7 +699,7 @@ " # particles, mask=particles.state <= 0, twiss=tw, # pass the lost particles\n", " timeseries=xplt.Timeseries(\n", " counts, dt=1e-6\n", - " ), # we can also use pre-binned timeseries data instead\n", + " ), # or we can also use pre-binned timeseries data instead\n", " kind=\"cv\",\n", ")" ] diff --git a/examples/twiss.ipynb b/examples/twiss.ipynb index f563473..fc3adad 100644 --- a/examples/twiss.ipynb +++ b/examples/twiss.ipynb @@ -147,7 +147,7 @@ "id": "714252cd-9c38-4574-844a-ee10a3e09235", "metadata": {}, "source": [ - "Create a default {class}`TwissPlot `:" + "Create a default {class}`TwissPlot ` (passing `line` to the plot adds a [beamline plot](examples/line.ipynb#multipole-strength) to the top):" ] }, { @@ -184,7 +184,7 @@ "id": "ace4bf8c-3038-47d3-a6b6-b174726a2008", "metadata": {}, "source": [ - "Use the parameter `kind` to specify what is plotted. See {class}`TwissPlot ` for details." + "Use the parameter `kind` to specify what is plotted. This is a string specifying the properties to be plotted, separated by `,` for each subplot. Use `a+b` to plot multiple properties on an axis and `a-b` to separate left and right axis. See {class}`TwissPlot ` for details." ] }, { @@ -202,6 +202,7 @@ } ], "source": [ + "# list available properties\n", "print(\", \".join(sorted(tw.keys(), key=lambda a: a.lower())))" ] }, @@ -240,17 +241,21 @@ ], "source": [ "plot = xplt.TwissPlot(\n", - " tw, figsize=(6, 5), kind=\"bet,mux+muy,dx\", display_units=dict(d=\"dm\")\n", + " tw,\n", + " kind=\"bet,mux+muy,dx\", # 3 subplots: plot beta functions (\"bet\"=\"betx+bety\") on the first,\n", + " # phase advances on the second, and dispersion on the third\n", + " display_units=dict(d=\"dm\"), # dispersion in deci-meter (\"d=\" for \"dx\" and \"dy\")\n", + " figsize=(6, 5),\n", ")\n", "\n", "# add some annotations\n", - "plot.axline(\n", - " \"s\", line.get_s_position(\"S6QF\"), annotation=\"My marker\", annotation_loc=\"upper\"\n", - ")\n", - "plot.axspan(\"s\", 9, 11, label=\"Section\")\n", + "plot.axline(\"s\", line.get_s_position(\"S6QF\"), annotation=\"S6QF\")\n", + "plot.axspan(\"s\", 9, 11, label=\"Section 42\")\n", + "plot.axline(\"muy\", tw.qy, annotation=f\"$Q_y={tw.qy:g}$\", annotation_loc=1)\n", "\n", "# adjust some axes\n", "plot.axis(0).set(title=\"Twiss plot example\", ylim=(0, 14))\n", + "plot.axis(\"mux\").set(ylim=(0, tw.qx))\n", "\n", "# adjust line layout\n", "plot.artist(\"mux\").set(ls=\"--\")\n",