Advanced examples
Create a plot in an App
In this example we show how to use the dedicated Simcenter Amesim widget for plot that is available in the User Interface editor of the App Designer.
A piece of code is copied from the Plot API demo in order to demonstrate how to use it in the main project of an app. It is recommended to keep the app from the Plot API demo open.
Procedure
Create a new App and select Dialog as type of window.
From the User Interface editor, select the Amesim Display Widgets Plot and drag-and-drop it onto your MainForm.
Figure 18: Widget Plot in a MainForm object
Select the MainForm object and apply a grid layout .
Select the plotWidget and rename it as myPlotWidget .
Figure 19: Grid layout applied
In the Plot API demo app select Separated Axes as plot type.
Copy all the code but the module import lines.
Then from the Python editor you can paste it in the section Insert extra code here/End of extra code of the mainform.py file at the line 70.
Figure 20: Insert code of plot method
Add the import of the modules in the section Insert extra code here/End of extra code at the line 11.
Figure 21: Insert import of modules
Call the createPlot method in the section Extra initialization declarations here/End of initialization at line 38 to display the plot in the widget.
Figure 22: Call createPlot method
Results
When you launch the app the following window appears:
Note
The values are defined by mathematical functions in the code. You can also retrieve variables from the model to have them in the plot instead.
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Plots_Python_API/xid1206367 · retrieved 2026-07-17