Graph
Methods
Static methods
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
>>> my_graph = project.get_graph('MyNewGraph')
>>> my_graph.export_html(
output_file = 'c:\User\particle\Desktop\my_new_graph.html',
layout = dict(
xaxis = dict(
range = [0, 20]
)
)
)>>> xtitle,ytitle = my_graph.get_axis_title()
>>> print(xtitle)
timestep
>>> print(ytitle)
Solid Fraction>>> my_graph = project.get_graph('Reaction Torque (base).empty')
>>> data = my_graph.get_data()
>>> print(data)
[
{'Time': [0,1,2,3]},
{'Torque': [0.0,0.0,0.0,0.0]}
]>>> labels = my_graph.get_labels()
>>> print(labels)
['timestep','curve 1','curve 2']>>> legends = my_graph.get_legend()
>>> print(legends)
['curve 1','curve 2']>>> layout = Graph.default_export_layout()
>>> print(layout)
{
'width': 800,
'height': 640
}>>> my_data = [
{
'x': list(xdata),
'y': list(ydata[0]),
'legendgroup': 'group', # this can be any string, not just "group"
'name': 'ydata_value',
'mode': 'lines',
'marker': {
'color': 'rgb(164, 194, 244)'
}
},
{
'x': list(xdata),
'y': list(ydata2),
'legendgroup': 'group', # this can be any string, not just "group"
'name': 'ydata_value squared',
'mode': 'lines+markers',
'marker': {
'color': 'rgb(142, 124, 195)'
},
'line': {
'width': 3
}
}
]
>>> my_layout = {
'title': 'Advanced plotly graph'.title(),
'xaxis': {
'title': xtitle.title(),
'showgrid': True,
'showline': True,
'zeroline': True,
'mirror': 'ticks'
},
'yaxis': {
'title': ytitle.title(),
'showgrid': True,
'showline': True,
'zeroline': True,
'mirror': 'ticks',
'type': 'log',
'autorange':True
}
}
>>> Graph.export_plotly(
file = 'C:\Users\particle\Desktop\my_graph.html',
data = my_data,
layout = my_layout
)