diff --git a/docs/_static/thumbnails/plot_contour_labels.png b/docs/_static/thumbnails/plot_contour_labels.png index 54259fa6..1af6059b 100644 Binary files a/docs/_static/thumbnails/plot_contour_labels.png and b/docs/_static/thumbnails/plot_contour_labels.png differ diff --git a/docs/_static/thumbnails/set_axes_limits_and_ticks.png b/docs/_static/thumbnails/set_axes_limits_and_ticks.png new file mode 100644 index 00000000..e0e46529 Binary files /dev/null and b/docs/_static/thumbnails/set_axes_limits_and_ticks.png differ diff --git a/docs/_static/thumbnails/set_titles_and_labels.png b/docs/_static/thumbnails/set_titles_and_labels.png new file mode 100644 index 00000000..45a49f81 Binary files /dev/null and b/docs/_static/thumbnails/set_titles_and_labels.png differ diff --git a/docs/examples.rst b/docs/examples.rst index e7b9bfcc..4ac9160c 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -22,6 +22,8 @@ Here are some examples of how to use geocat-viz. examples/add_lat_lon_gridlines.ipynb examples/add_lat_lon_ticklabels.ipynb examples/set_tick_direction_spine_visibility.ipynb + examples/set_titles_and_labels.ipynb + examples/set_axes_limits_and_ticks.ipynb examples/add_right_hand_axis.ipynb examples/add_major_minor_ticks.ipynb examples/find_local_extrema.ipynb diff --git a/docs/examples/set_axes_limits_and_ticks.ipynb b/docs/examples/set_axes_limits_and_ticks.ipynb new file mode 100644 index 00000000..a47f46d4 --- /dev/null +++ b/docs/examples/set_axes_limits_and_ticks.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# `set_axes_limits_and_ticks`\n", + "\n", + "This notebook is a simple example of the GeoCAT-viz function set_axes_limits_and_ticks." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Import packages:\n", + "\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "\n", + "import geocat.viz as gv" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generate example data:\n", + "\n", + "npts = 500\n", + "\n", + "x = 500 + 0.9 * np.arange(0, npts) * np.cos(np.pi / 100 * np.arange(0, npts))\n", + "y = 500 + 0.9 * np.arange(0, npts) * np.sin(np.pi / 100 * np.arange(0, npts))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Create plot\n", + "\n", + "# Create a figure\n", + "fig, ax = plt.subplots()\n", + "\n", + "# Plot the example data\n", + "ax.plot(x, y)\n", + "\n", + "# Use geocat.viz.util convenience function to set axes limits and tick labels\n", + "gv.set_axes_limits_and_ticks(ax,\n", + " xlim=(0, 900),\n", + " ylim=(100, 1000),\n", + " xticks=range(0, 901, 100),\n", + " yticks=range(100, 1001, 100))\n", + "\n", + "# Show the plot\n", + "plt.show();" + ] + } + ], + "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.11.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/docs/examples/set_titles_and_labels.ipynb b/docs/examples/set_titles_and_labels.ipynb new file mode 100644 index 00000000..78343c7f --- /dev/null +++ b/docs/examples/set_titles_and_labels.ipynb @@ -0,0 +1,88 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# `set_titles_and_labels`\n", + "\n", + "This notebook is a simple example of the GeoCAT-viz function set_titles_and_labels." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Import packages:\n", + "\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "\n", + "import geocat.viz as gv" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Generate example data:\n", + "\n", + "npts = 500\n", + "\n", + "x = 500 + 0.9 * np.arange(0, npts) * np.cos(np.pi / 100 * np.arange(0, npts))\n", + "y = 500 + 0.9 * np.arange(0, npts) * np.sin(np.pi / 100 * np.arange(0, npts))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Create plot\n", + "\n", + "# Create a figure\n", + "fig, ax = plt.subplots()\n", + "\n", + "# Plot the example data\n", + "ax.plot(x, y)\n", + "\n", + "# Use geocat.viz.util convenience function to set titles and labels\n", + "gv.set_titles_and_labels(ax,\n", + " maintitle=\"Title\",\n", + " maintitlefontsize=24,\n", + " xlabel=\"x\",\n", + " ylabel=\"y\",\n", + " labelfontsize=16)\n", + "\n", + "# Show the plot\n", + "plt.show();" + ] + } + ], + "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.11.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/docs/gallery.yml b/docs/gallery.yml index 6e060c95..eab7f1ec 100644 --- a/docs/gallery.yml +++ b/docs/gallery.yml @@ -33,3 +33,11 @@ - title: 'plot_extrema_labels' path: examples/plot_extrema_labels.ipynb thumbnail: _static/thumbnails/plot_extrema_labels.png + +- title: 'set_titles_and_labels' + path: examples/set_titles_and_labels.ipynb + thumbnail: _static/thumbnails/set_titles_and_labels.png + +- title: 'set_axes_limits_and_ticks' + path: examples/set_axes_limits_and_ticks.ipynb + thumbnail: _static/thumbnails/set_axes_limits_and_ticks.png diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 582b0b38..268cc6dd 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -7,11 +7,12 @@ Release Notes v2023.11.0 (Unreleased) ----------------------- -[Plain text summary here] + Documentation ^^^^^^^^^^^^^ -* Invert y-axis in add_height_from_pressure_axis example by `Katelyn FitzGerald`_ in (:pr:`173`) +* Invert y-axis in ``add_height_from_pressure_axis`` example by `Katelyn FitzGerald`_ in (:pr:`173`) +* Additions to the examples gallery for ``set_titles_and_labels`` and ``set_axes_limits_and_ticks`` and updated thumbnail for ``plot_contour_labels`` by `Katelyn FitzGerald`_ in (:pr:`181`) Bug Fixes ^^^^^^^^^