{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Plot Scalars Over a Circular Arc\n\nInterpolate the scalars of a dataset over a circular arc.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import pyvista as pv\nfrom pyvista import examples" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Volumetric Mesh\n\nAdd the height scalars to a uniform 3D mesh.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "mesh = examples.load_uniform()\nmesh['height'] = mesh.points[:, 2]\n\n# Make two points at the bounds of the mesh and one at the center to\n# construct a circular arc.\nnormal = [0, 1, 0]\npolar = [mesh.bounds[0], mesh.bounds[2], mesh.bounds[5]]\ncenter = [mesh.bounds[0], mesh.bounds[2], mesh.bounds[4]]\nangle = 90.0\n\n# Preview how this circular arc intersects this mesh\narc = pv.CircularArcFromNormal(center, 100, normal, polar, angle)\n\np = pv.Plotter()\np.add_mesh(mesh, style=\"wireframe\", color=\"w\")\np.add_mesh(arc, color=\"b\")\na = arc.points[0]\nb = arc.points[-1]\np.add_point_labels([a, b], [\"A\", \"B\"], font_size=48, point_color=\"red\", text_color=\"red\")\np.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run the filter and produce a line plot.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "mesh.plot_over_circular_arc_normal(center, 100, normal, polar, angle, 'height')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.2" } }, "nbformat": 4, "nbformat_minor": 0 }