{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# 3D plots\n\nPlot the 3D geometry and results\n\nDownload Input files\n\n* :download:`dipole_3d.data <../../../../../examples/input_files/dipole_3d.data>`\n* :download:`dipole_3d.post.xml <../../../../../examples/input_files/dipole_3d.post.xml>`\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setting up\nStandard Loading of input, Parsing and Initializing RoxiePlotOutputs object\n\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from roxieapi.output.plots import RoxiePlotOutputs\n\nplots = RoxiePlotOutputs(\n \"../input_files/dipole_3d.post.xml\", \"../input_files/dipole_3d.data\"\n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Extracting plot information\nLoad 3D plot and get plot information\n\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "parser = plots.output\n\np3d = parser.get_3d_plot(1) # We load Plot Number 1 (defined in datafile)\nassert p3d is not None" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create the plot\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "figure = plots.plots3d.plot_3d(p3d)\nfigure.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Changing the dataset to plot\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(\"Available Datasets:\")\nfor id, pl in enumerate(p3d.coilPlots):\n print(f\"Index {id} with label {pl.label}\")\n# Set the new prefered dataset:\np3d.active = p3d.coilPlots[2]\n\n# Print with new dataset\nfigure2 = plots.plots3d.plot_3d(p3d)\nfigure2.show()" ] } ], "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.9.19" } }, "nbformat": 4, "nbformat_minor": 0 }