Creating Tables and Visuals in Python
Display tabular data and visual outputs directly from your Python calculations using list-based tables and matplotlib figures.
Python sources in CalcTree support both tabular data and visual outputs such as plots and charts. This allows you to include structured results and engineering figures directly within your calculation pages.
Creating Tables
To create a table, define a root-level Python variable as a list of lists. Each inner list will be treated as a row in the table.
Example:
This will display a 2-row table under the Python source block on the right-hand panel.
Generating Visuals
You can use the matplotlib
library to create charts and plots. If your Python source includes a matplotlib
figure, CalcTree will automatically detect and display it below the script.
Example:
The figure will appear in the output panel below your Python code. Click the three-dot menu, and 'intsert parameter' to add the figure to anywhere in your page.
Notes
Only
matplotlib
figures are currently supportedTables must be declared as simple list-of-list objects at the root level
Both outputs update live as you edit your code or parameters on the page linked to these elements
Last updated