Hello, i am trying to generate 2D plots with python API. The code i use is:
inputs = [em_sensor_extractor.Outputs["EM E(x,y,z,f0)"]]
plot_viewer = analysis.viewers.PlotViewer(inputs=inputs)
plot_viewer.Name = "2D Line Extraction"
plot_viewer.Plotter.Decibel = True
plot_viewer.Plotter.DbRef = 487.989753241
When i run this code the program doesn't recognize the input connection. Any idea what is wrong with the code? Furthermore i would like the 2D plot mode to be temporal but i can't find the corresponding functions in the API library. Thank you in advance!
Hi, you get an error because your input is a 3D field (EM E(x,y,z,f0)) and this viewer expects 1D data (e.g. E as a function of x).
To address this, you can use the 1D Field Filter (under Field Tools in the GUI) to first extract one-dimensional data out of your 3D field, and then connect the Plot viewer. Do it first in the GUI, then use To-Python function in the context menu to create your script.
I hope this helps.