{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Figure gallery\n", "\n", "\n", "Here are examples of figures built using PyARPES.\n", "\n", "Most plotting methods or functions come with a wide array of options, offering countless possibilities for customization. These options allow users to adjust everything from color schemes and line styles to axis scaling and annotations, making it possible to tailor visualizations to specific requirements. Understanding these possibilities is key to unlocking the full potential of data visualization tools. Ultimately, a deep understanding of the original library, such as Matplotlib or HoloViews, may sometimes be required. However, even in such cases, it can be challenging to even begin searching for solutions if you are unaware of what is possible in the first place.\n", "\n", "This is why exploring examples and documentation is so important. By observing what others have accomplished, you can better understand the library's capabilities and discover features that align with your needs. Tutorials and sample code often serve as gateways, enabling you to experiment and steadily deepen your knowledge. However, it's crucial to balance ambition with practicality. Start with simple visualizations and focus on mastering the fundamentals before attempting complex customizations. This approach ensures a solid foundation and reduces frustration. Remember, learning these tools is an iterative process, and each experiment brings you closer to unlocking their full potential." ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "# matplotlib default colormap is sufficiently good. But in some case, another colormap is preferred.\n", "# \"cmap\" includes colormaps of matplotlib, cmocean, colorbrewer, crameri and seaborn.\n", "# \"pip install cmap may be required.\"\n", "import cmap\n", "\n", "import arpes\n", "from arpes.io import example_data\n", "\n", "# Most of plotting functions are designed for xr.DataArray (while xr.Dataset can be accepted in many case)\n", "cut = example_data.cut.spectrum\n", "cut2 = example_data.cut2.spectrum\n", "map = example_data.map.spectrum" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## Very basic:\n", "The defact standard for showing the ARPES data is colormesh. Thus, if the xr.DataArray is 2D (i.e. \"cut\" type data), .S shows data as the color image." ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "cut.S" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "# Logarithmic scale\n", "from matplotlib.colors import LogNorm\n", "\n", "fig, ax = plt.subplots()\n", "cut2.transpose(\"eV\", ...).plot(ax=ax, cmap=plt.cm.jet, norm=LogNorm(vmin=1, vmax=100))\n", "ax.set_ylabel(\"Energy relative to E_F ( eV )\")\n", "ax.set_xlabel(\"Emission Angle ( rad )\")\n", "ax.set_title(\"Xe/Au(111) monochromatic 2PPE\")" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "## Stack plot\n", "\n", "The colormap is the defact standard for the way to present ARPES data currently. But in most case, especially when the detailed structure of the spectrum is interested, the curve representation is more preferred." ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "from arpes.plotting import stack_plot" ] }, { "cell_type": "code", "execution_count": null, "id": "7", "metadata": {}, "outputs": [], "source": [ "fig, ax = plt.subplots(nrows=1, ncols=2)\n", "fig.set_size_inches((8, 3))\n", "_, ax[0] = stack_plot.stack_dispersion_plot(\n", " cut2,\n", " max_stacks=20,\n", " scale_factor=0.3,\n", " title=\"2PPE Xe/Au(111)\",\n", " linewidth=0.3,\n", " color=\"plasma\",\n", " shift=0.00,\n", " mode=\"hide_line\",\n", " label=\"label test\",\n", " # figsize=(7, 5),\n", " ax=ax[0],\n", ")\n", "\n", "_, ax[1] = stack_plot.stack_dispersion_plot(\n", " cut2,\n", " max_stacks=130,\n", " title=\"2PPE Xe/Au(111)\",\n", " linewidth=0.5,\n", " color=cmap.Colormap(\"icefire\").to_matplotlib(),\n", " shift=0.00,\n", " label=\"label test\",\n", " mode=\"hide_line\",\n", " # figsize=(7, 4),\n", " ax=ax[1],\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "fig, ax = plt.subplots(nrows=1, ncols=2)\n", "fig.set_size_inches((8, 3))\n", "_, ax[0] = stack_plot.stack_dispersion_plot(\n", " cut,\n", " max_stacks=10,\n", " scale_factor=0.1,\n", " title=\"2PPE Xe/Au(111)\",\n", " linewidth=0.5,\n", " color=cmap.Colormap(\"batlow\").to_matplotlib(),\n", " shift=0.00,\n", " label=\"label test\",\n", " mode=\"fill_between\",\n", " offset_correction=\"zero\",\n", " ax=ax[0],\n", ")\n", "\n", "_, ax[1] = stack_plot.flat_stack_plot(\n", " cut, color=cmap.Colormap(\"Blues\").to_matplotlib(), max_stacks=40, ax=ax[1]\n", ")\n", "\n", "fig.tight_layout()" ] }, { "cell_type": "markdown", "id": "9", "metadata": {}, "source": [ "## Fermi surface plot" ] }, { "cell_type": "markdown", "id": "10", "metadata": {}, "source": [ "## Fermi surface plot" ] }, { "cell_type": "markdown", "id": "11", "metadata": {}, "source": [ "## ARPES data with a single spectrum" ] }, { "cell_type": "markdown", "id": "12", "metadata": {}, "source": [ "## XPS" ] }, { "cell_type": "code", "execution_count": null, "id": "13", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.11" } }, "nbformat": 4, "nbformat_minor": 5 }