.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gen/examples/output_parsing/plot_graphs.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gen_examples_output_parsing_plot_graphs.py: Graph plots =================== Use the output of roxie defined graphs and plot them using plotly Download Input files * :download:`dipole_2d.data <../../../../../examples/input_files/dipole_iron_trans_opt.data>` * :download:`dipole_2d.post.xml <../../../../../examples/input_files/dipole_iron_trans_opt.post.xml>` .. GENERATED FROM PYTHON SOURCE LINES 14-18 Setting up ---------- Standard Loading of input, Parsing and Initializing RoxiePlotOutputs object .. GENERATED FROM PYTHON SOURCE LINES 18-28 .. code-block:: Python from roxieapi.output.plots import RoxiePlotOutputs plots = RoxiePlotOutputs( "../input_files/dipole_2D_trans_opt.post.xml", "../input_files/dipole_2D_trans_opt.data", ) parser = plots.output graphs = plots.graphs .. GENERATED FROM PYTHON SOURCE LINES 29-38 Listing all Roxie defined Graphs ----------------------------------- Roxie defines 3 types of graphs * Device graphs (for exery time step) * Transient graphs (Time dependent data) * Optimization graphs Shows available plots for each segment Note that device plots also list 2D plots .. GENERATED FROM PYTHON SOURCE LINES 38-50 .. code-block:: Python print("Device plots") for pl in parser.graphs_device: print(f" - {pl}") print("Transient plots") for pl in parser.graphs_transient: print(f" - {pl}") print("Optimization plots") for pl in parser.graphs_optimization: print(f" - {pl}") .. rst-class:: sphx-glr-script-out .. code-block:: none Device plots - GraphPlot(title='Path plot', id=1, axes={'X': PlotAxis(label='', bounds=None, log=False), 'Y': PlotAxis(label='', bounds=None, log=False)}, graphs=[GraphInfo(id=1, graph_type=1, xval='ARCL', yval='|B|', logx=True, logy=True, weight=1.0, label=None), GraphInfo(id=4, graph_type=1, xval='ARCL', yval='BX', logx=True, logy=True, weight=1.0, label=None)]) - GraphPlot(title='My harm coil', id=2, axes={'X': PlotAxis(label='', bounds=None, log=False), 'Y': PlotAxis(label='', bounds=None, log=False)}, graphs=[GraphInfo(id=2, graph_type=1, xval='PHI', yval='BR', logx=True, logy=True, weight=1.0, label=None), GraphInfo(id=3, graph_type=1, xval='PHI', yval='BPHI', logx=True, logy=True, weight=1.0, label=None)]) Transient plots - GraphPlot(title='Graph 3', id=3, axes={'X': PlotAxis(label='', bounds=None, log=False), 'Y': PlotAxis(label='', bounds=None, log=False)}, graphs=[GraphInfo(id=5, graph_type=2, xval='TIME', yval='STRONG', logx=True, logy=True, weight=1.0, label=None)]) - GraphPlot(title='Graph 4', id=4, axes={'X': PlotAxis(label='', bounds=None, log=False), 'Y': PlotAxis(label='', bounds=None, log=False)}, graphs=[GraphInfo(id=6, graph_type=2, xval='TIME', yval='b3', logx=True, logy=True, weight=1.0, label=None)]) Optimization plots - GraphPlot(title='Graph 5', id=5, axes={'X': PlotAxis(label='', bounds=None, log=False), 'Y': PlotAxis(label='', bounds=None, log=False)}, graphs=[GraphInfo(id=7, graph_type=3, xval='NSTEP', yval='DV', logx=True, logy=True, weight=1.0, label=None), GraphInfo(id=8, graph_type=3, xval='NSTEP', yval='DV', logx=True, logy=True, weight=1.0, label=None), GraphInfo(id=9, graph_type=3, xval='NSTEP', yval='DV', logx=True, logy=True, weight=1.0, label=None)]) .. GENERATED FROM PYTHON SOURCE LINES 51-55 Plotting a graph ---------------- Using the Graph plotter, each graph can be output directly as a plotly graph .. GENERATED FROM PYTHON SOURCE LINES 55-61 .. code-block:: Python # Plot the first device plot graph in transient step 1, optimization step 1 plots.output_optimization_graphs(plots=[5]) # plots.output_device_graphs(1, 1, plots=[1]) .. rst-class:: sphx-glr-script-out .. code-block:: none {'text/html': '
'} .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.098 seconds) .. _sphx_glr_download_gen_examples_output_parsing_plot_graphs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_graphs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_graphs.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_graphs.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_