{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Custom 3D plots\n\nCreate a custom 3D plot from custom data sets (Plot not defined in Roxie)\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.commons.roxie_constants import PlotLabels\nfrom roxieapi.commons.types import Plot3D\nfrom roxieapi.output.plots import RoxiePlotOutputs\n\nplots = RoxiePlotOutputs(\n \"../input_files/dipole_3d.post.xml\", \"../input_files/dipole_3d.data\"\n)\nparser = plots.output" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Show all defined 3D plots dataset\nLoad 3D plot and get plot information\n\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "step = parser.find_transstep(1, 1)\nassert step is not None\nprint(\"Defined 3D plot Data:\")\nfor col in step.coilData3D.columns[1:]:\n lbl, desc = PlotLabels.lbl_desc_plot3D(col)\n print(f\" Id: {col}, Label: {lbl}, Description: {desc}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create the plot description\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "p3d = Plot3D.create(\"Custom 3D Plot for FR\")\np3d.add_coilPlot(\"6\")\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()" ] } ], "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 }