{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# PIVPy graphics tutorial" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "import numpy as np\n", "from pivpy import io, pivpy, graphics\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "## Let's create a sample dataset" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df = io.create_sample_Dataset()\n", "df" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(10,10))\n", "graphics.quiver(df.piv.average,arrScale=3,streamlines=True);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(figsize=(10,10)) \n", "# plot quiver of the first frame (t[0]), selected by .isel and apply quiver()\n", "df.isel(t=0).piv.quiver(arrScale=7,streamlines=True) " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig,ax = graphics.contour_plot(df.isel(t=-1),colorbar='vertical')\n", "fig.set_size_inches(6,6)\n", "ax.set_xlabel('$x$ (pix)',fontsize=16);" ] } ], "metadata": { "kernelspec": { "display_name": "pivpy", "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.13.9" } }, "nbformat": 4, "nbformat_minor": 4 }