Oasys.THIS.Graph class¶
Constants¶
- Graph.AXIS_LINEAR¶
Linear axis type
- Graph.AXIS_LOG¶
Logarithmic axis type
- Graph.FONT_COURIER_BOLD¶
Courier bold font
- Graph.FONT_COURIER_MEDIUM¶
Courier medium font
- Graph.FONT_DEFAULT¶
Takes the font defined in the preference file
- Graph.FONT_HELVETICA_BOLD¶
Helvetical bold font
- Graph.FONT_HELVETICA_MEDIUM¶
Helvetical medium font
- Graph.FONT_SIZE_10¶
10 point font size
- Graph.FONT_SIZE_12¶
12 point font size
- Graph.FONT_SIZE_14¶
14 point font size
- Graph.FONT_SIZE_18¶
18 point font size
- Graph.FONT_SIZE_24¶
24 point font size
- Graph.FONT_SIZE_8¶
8 point font size
- Graph.FONT_SIZE_AUTO¶
Font size would be automatically adjusted based on the graph area
- Graph.FONT_TIMES_BOLD¶
Times New Roman bold font
- Graph.FONT_TIMES_MEDIUM¶
Times New Roman medium font
- Graph.GRID_OFF¶
Turn off the grid
- Graph.GRID_ON¶
Turn on the grid
- Graph.LEGEND_1_COLUMN¶
Curve labels will be displayed in a single column in the legend
- Graph.LEGEND_2_COLUMN¶
Curve labels will be displayed in two columns in the legend
- Graph.NO¶
Flag for no
- Graph.OFF¶
Flag to turn off
- Graph.ON¶
Flag to turn on
- Graph.PREFIX_DIR¶
Directory name of the model will be used as the curve label prefix in the legend (see Legend)
- Graph.PREFIX_MODEL_NUMBER¶
Model number will be used as the curve label prefix in the legend (see Legend)
- Graph.PREFIX_THF¶
Root name of the THF file will be used as the curve label prefix in the legend (see Legend)
- Graph.PREFIX_USER_DEFINED¶
A user defined prefix will be used as the curve label prefix in the legend (see Legend)
- Graph.YES¶
Flag for yes
Properties¶
- property Graph.active: constant¶
If the graph is active or inactive. Can take Graph.YES or Graph.NO
- property Graph.add_x_units: constant¶
shows x-axis units. It can take either Graph.ON or Graph.OFF
- property Graph.add_y2_units: constant¶
shows second y-axis units. It can take either Graph.ON or Graph.OFF
- property Graph.add_y_units: constant¶
shows y-axis units. It can take either Graph.ON or Graph.OFF
- property Graph.auto_title: string¶
Turn on to set graph title automatically and turn off to define the graph title manually using the property Graph.title. Can take either Graph.ON or Graph.OFF
- property Graph.auto_xlabel: constant¶
Turn on to set label for the x-axis automatically and turn off to define the label for the x-axis manually using the property xlabel. Can take either Graph.ON or Graph.OFF
- property Graph.auto_xmax: constant¶
Can take either Graph.ON or Graph.OFF. Graph.ON will set the maximum value for the y-axis range automatically and Graph.OFF will use the property xmax value as the maximum value for the x-axis range
- property Graph.auto_xmin: constant¶
Can take either Graph.ON or Graph.OFF. Graph.ON will set the minimum value for the x-axis range automatically and Graph.OFF will use the property xmin value as the minimum value for the x-axis range
- property Graph.auto_y2label: constant¶
Turn on to set label for the second y-axis automatically and turn off to define the label for the second y-axis manually using the property y2label. Can take either Graph.ON or Graph.OFF
- property Graph.auto_y2max: constant¶
Can take either Graph.ON or Graph.OFF. Graph.ON will set the maximum value for the second y-axis range automatically and Graph.OFF will use the property y2max value as the maximum value for the second y-axis range
- property Graph.auto_y2min: constant¶
Can take either Graph.ON or Graph.OFF. Graph.ON will set the minimum value for the second y-axis range automatically and Graph.OFF will use the property y2min value as the minimum value for the second y-axis range
- property Graph.auto_ylabel: constant¶
Turn on to set label for the y-axis automatically and turn off to define the label for the y-axis manually using the property ylabel. Can take either Graph.ON or Graph.OFF
- property Graph.auto_ymax: constant¶
Can take either Graph.ON or Graph.OFF. Graph.ON will set the maximum value for the y-axis range automatically and Graph.OFF will use the property ymax value as the maximum value for the y-axis range
- property Graph.auto_ymin: constant¶
Can take either Graph.ON or Graph.OFF. Graph.ON will set the minimum value for the y-axis range automatically and Graph.OFF will use the property ymin value as the minimum value for the y-axis range
- property Graph.background_colour: Colour¶
Graph background colour
- property Graph.foreground_colour: Colour¶
Graph foreground colour
- property Graph.grid: constant¶
To turn on/off the grid. Can take Graph.GRID_ON or Graph.GRID_OFF
- property Graph.id(read only): integer¶
Graph ID
- property Graph.legend_background_colour: Colour¶
Background colour for the legend area
- property Graph.legend_background_trans: integer¶
Transparancy of the legend area. The value should lie between 0 and 100
- property Graph.legend_font: constant¶
Font for the curve labels in the legend. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.legend_font_colour: Colour¶
Font colour for the curve labels in the legend
- property Graph.legend_font_size: constant¶
Font size for the curve labels in the legend. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.legend_layout: constant¶
Defines the legend layout type. Can take Graph.LEGEND_COLUMN_LIST, Graph.LEGEND_AUTO, Graph.LEGEND_OFF or Graph.LEGEND_FLOATING
- property Graph.legend_prefix_format: constant¶
Format of the prefix that is being included in the curve label of the legend. Can take either Graph.PREFIX_MODEL_NUMBER, Graph.DIR, Graph.PREFIX_THF or Graph.PREFIX_USER_DEFINED
- property Graph.legend_show_prefix: constant¶
Include the prefix in the curve label of the legend. Can take either Graph.PREFIX_AUTO, Graph.PREFIX_ON or Graph.PREFIX_OFF
- property Graph.legend_show_user_lines: constant¶
Visibility of user lines when Graph.LEGEND_COLUMN_LIST is selected for legend layout. Can take either Graph.ON or Graph.OFF
- property Graph.legend_user_line_1: string¶
User defined line 1 from the legend area
- property Graph.legend_user_line_1_size: constant¶
Font size for the user defined line 1. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.legend_user_line_2: string¶
User defined line 2 from the legend area
- property Graph.legend_user_line_2_size: constant¶
Font size for the user defined line 2. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.legend_user_line_3: string¶
User defined line 3 from the legend area
- property Graph.legend_user_line_3_size: constant¶
Font size for the user defined line 3. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.legend_user_line_4: string¶
User defined line 4 from the legend area
- property Graph.legend_user_line_4_size: constant¶
Font size for the user defined line 4. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.legend_user_line_5: string¶
User defined line 6 from the legend area
- property Graph.legend_user_line_5_size: constant¶
Font size for the user defined line 5. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.legend_user_line_6: string¶
User defined line 6 from the legend area
- property Graph.legend_user_line_6_size: constant¶
Font size for the user defined line 6. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.legend_user_lines_colour: Colour¶
Font colour for the user defined lines in the legend
- property Graph.legend_user_lines_font: constant¶
Font for the user defined lines in the legend. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.num_legend_columns: constant¶
Number of columns of curve labels in legends. Can take Graph.LEGEND_1_COLUMN, Graph.LEGEND_2_COLUMN or Graph.LEGEND_3_COLUMN
- property Graph.show_title: string¶
Shows graph title. Can take either Graph.ON or Graph.OFF
- property Graph.show_xlabel: constant¶
Shows graph x-axis label. Can take either Graph.ON or Graph.OFF
- property Graph.show_y2label: constant¶
Shows graph second y-axis label. Can take either Graph.ON or Graph.OFF
- property Graph.show_ylabel: constant¶
Shows graph y-axis label. Can take either Graph.ON or Graph.OFF
- property Graph.title: string¶
Graph title
- property Graph.x_axis_type: constant¶
Defines x-axis type i.e. linear or logarithmic. Can take either Graph.AXIS_LINEAR or Graph.AXIS_LOG
- property Graph.x_unit_colour: Colour¶
Colour of the x-axis units
- property Graph.x_unit_decimals: integer¶
Defines the number decimals in the x-axis units
- property Graph.x_unit_font: constant¶
Font for the x-axis units. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.x_unit_format: constant¶
Defines the format for the x-axis units. Can take either Graph.AXIS_UNITS_AUTO, Graph.AXIS_UNITS_SCIENTIFIC or Graph.AXIS_UNITS_GENERAL
- property Graph.x_unit_size: constant¶
Font size for the x-axis units. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.xlabel: string¶
Label for x-axis
- property Graph.xlabel_colour: Colour¶
Colour of the x-axis label
- property Graph.xlabel_font: constant¶
Font for the x-axis label. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.xlabel_size: constant¶
Font size for the x-axis label. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.xmax: float¶
Maximum value of x-axis range
- property Graph.xmin: float¶
Minimum value of the x-axis range
- property Graph.y2_axis_type: constant¶
Defines second y-axis type i.e. linear or logarithmic. Can take either Graph.AXIS_LINEAR or Graph.AXIS_LOG
- property Graph.y2_unit_colour: Colour¶
Colour of the second y-axis units
- property Graph.y2_unit_decimals: integer¶
Defines the number decimals in the second y-axis units
- property Graph.y2_unit_font: constant¶
Font for the second y-axis label. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.y2_unit_format: constant¶
Defines the format for the second y-axis units. Can take either Graph.AXIS_UNITS_AUTO, Graph.AXIS_UNITS_SCIENTIFIC or Graph.AXIS_UNITS_GENERAL
- property Graph.y2_unit_size: constant¶
Font size for the second y-axis units. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.y2label: string¶
Label for second y-axis
- property Graph.y2label_colour: Colour¶
Colour of the second y-axis label
- property Graph.y2label_font: constant¶
Font for the second y-axis label. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.y2label_size: constant¶
Font size for the second y-axis label. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.y2max: float¶
Maximum value of the second y-axis range
- property Graph.y2min: float¶
Minimum value of the second y-axis range
- property Graph.y_axis_type: constant¶
Defines y-axis type i.e. linear or logarithmic. Can take either Graph.AXIS_LINEAR or Graph.AXIS_LOG
- property Graph.y_unit_colour: Colour¶
Colour of the y-axis units
- property Graph.y_unit_decimals: integer¶
The number decimals in the y-axis units
- property Graph.y_unit_font: constant¶
Font for the y-axis units. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.y_unit_format: constant¶
Defines the format for the y-axis units. Can take either Graph.AXIS_UNITS_AUTO, Graph.AXIS_UNITS_SCIENTIFIC or Graph.AXIS_UNITS_GENERAL
- property Graph.y_unit_size: constant¶
Font size for the y-axis units. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.ylabel: string¶
Label for y-axis
- property Graph.ylabel_colour: Colour¶
Colour of the y-axis label
- property Graph.ylabel_font: constant¶
Font for the y-axis label. Can take either Graph.FONT_DEFAULT, Graph.FONT_HELVETICA_MEDIUM, Graph.FONT_HELVETICA_BOLD, Graph.FONT_TIMES_MEDIUM, Graph.FONT_TIMES_BOLD, Graph.FONT_COURIER_MEDIUM or Graph.FONT_COURIER_BOLD
- property Graph.ylabel_size: constant¶
Font size for the y-axis label. Can take either Graph.FONT_SIZE_AUTO, Graph.FONT_SIZE_8, Graph.FONT_SIZE_10, Graph.FONT_SIZE_12, Graph.FONT_SIZE_14, Graph.FONT_SIZE_18 or Graph.FONT_SIZE_24
- property Graph.ymax: float¶
Maximum value of y-axis range
- property Graph.ymin: float¶
Minimum value of the y-axis range
Constructor¶
- classmethod Graph(index=Oasys.gRPC.defaultArg)¶
Create a new
Graph
- Parameters:
index (integer) – Optional. Graph index to copy initial display and axis settings from (optional). If not defined then the display and axis settings will be copied from those defined in the preference file
- Returns:
Graph object
- Return type:
dict
Example
To create a new graph and copy all of the setting from graph 2
l = Oasys.THIS.Graph(2)
Static methods¶
- classmethod Graph.DeleteFromID(id)¶
Deletes a graph
- Parameters:
id (integer) – ID of graph to delete
- Returns:
No return value
- Return type:
None
Example
To delete the graph n
Oasys.THIS.Graph.DeleteFromID(n)Maximum number of graphs in T/HIS is 32
- classmethod Graph.GetFromID(id)¶
Returns the graph object for a given graph id
- Parameters:
id (integer) – ID of graph to return the graph for
- Returns:
Graph object or None if graph does not exists
- Return type:
Graph
Example
To get the graph n
num = Oasys.THIS.Graph.GetFromID(n)Maximum number of graphs in T/HIS is 32
- classmethod Graph.Total()¶
Returns the total number of graphs
- Returns:
integer
- Return type:
int
Example
To find how many graphs there are in T/HIS:
num = Oasys.THIS.Graph.Total()
Instance methods¶
- Graph.AddCurveID(curve_id, no_redraw=Oasys.gRPC.defaultArg)¶
Adds a curve to the graph
- Parameters:
curve_id (Integer) – ID of the curve to add
no_redraw (Integer) – Optional. If this argument is 1 then the graph will not be redrawn after the curve is added. This is to be used if a large number of curves are to be added to a graph, so as to avoid the same curves being drawn multiple times. No argument or 0 will trigger a redraw after the curve is added
- Returns:
Returns True if the curve is successfully added to the graph else it would return False
- Return type:
bool
Example
To add a curve with id (n) to the graph (g):
g.AddCurveID(n)
- Graph.AddToPage(page_number)¶
Adds the graph to the page
- Parameters:
page_number (Integer) – Page number for which to add the graph to
- Returns:
Returns True if the graph is successfully added to the page else it would return False
- Return type:
bool
Example
To add a graph (g) to page id (n):
g.AddToPage(n)
- Graph.Delete()¶
Deletes the graph
- Returns:
No return value
- Return type:
None
Example
Deletes the graph (g)
g.Delete()
- Graph.GetAllCurveIDs()¶
Returns the IDs of the curves present in the graph in a list
- Returns:
Array of curve IDs
- Return type:
list
Example
To get the list of all the curve ids present in a graph (g):
num = g.GetAllCurveIDs()
- Graph.GetAllPageIDs()¶
Returns all the pages containing the graph
- Returns:
Array of page IDs
- Return type:
list
Example
To get the list of all page ids containing the graph (g):
pages_ids = g.GetAllPageIDs()
- Graph.GetNumCurves()¶
Returns number curves present in the graph
- Returns:
Number of curves present in the graph
- Return type:
int
Example
To find number of curves in a graph (g):
num = g.GetNumCurves()
- Graph.Lock(lock_type)¶
Locks the blanking status of either blanked curves, unblanked curves or all curves on the graph
- Parameters:
lock_type (Integer) – No argument or 0 to lock blanked curves, -1 to unlock blanked curves, -2 to unfreeze all visible curves
- Returns:
No return value
- Return type:
None
Example
To lock all blanked curves on graph g:
g.Lock()
- Graph.RemoveCurveID(id)¶
Removes a curve from the graph
- Parameters:
id (Integer) – ID of the curve to be removed
- Returns:
Returns True if the curve is successfully removed from the graph else it would return False
- Return type:
bool
Example
To remove a curve with id (n) from the graph (g):
g.RemoveCurveID(n)
- Graph.RemoveFromPage(id)¶
Removes the graph from a page
- Parameters:
id (Integer) – ID of the page from which the graph is to be removed
- Returns:
Returns True if the graph is successfully removed from the page else it would return False
- Return type:
bool
Example
To remove the graph (g) from page with id (n):
g.RemoveFromPage(n)