""" 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>` """ # %% # Setting up # ---------- # Standard Loading of input, Parsing and Initializing RoxiePlotOutputs object # 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 # %% # 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 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}") # %% # Plotting a graph # ---------------- # Using the Graph plotter, each graph can be output # directly as a plotly graph # 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]) # %%