Iota Python API
1.0.0
1.0.0
  • Introduction
  • Getting started with Iota Python Library and Iota IPython Terminal
    • Starting a Session
    • Creating a New Project
    • Loading a Project
    • Creating a New Scenario
    • Loading a Scenario
    • Importing a Dataset
    • Running Coarse-graining
  • Writing Scripts
    • Generic Scripts
    • Run(scenario) Scripts
  • Running Scripts
    • Running Generic Scripts
    • Running run(scenario) Scripts
  • Iota Python Reference Library
    • Datasets
    • Graphs
    • Scene renderer
    • Meshing
    • Variable types
    • Session
    • Project
    • Scenario
    • Graph
    • Dataset
    • Mesh
    • Script
    • File
    • Auxiliar
    • Enums
  • Examples
    • Creating a New Project
    • Creating a New Scenario
    • Creating Multiple Scenarios
    • Loading a Project and a Scenario
    • Importing a Dataset into a Scenario
    • Importing Multiple Datasets into different Scenarios
    • Creating a Cut-Plane with Results in a Dataset
    • Creating a New Result in a Dataset
    • Calculating a KPI and Exporting into a Graph
    • Getting the Profile of Result along a Line
    • Creating Multiple Result Line Variations and Plotting them in a Single Graph
    • Integrating a Result over a Mesh
    • Getting the Evolution of the Statistics of a Result
    • Creating Multiple Screenshots of a Dataset
    • Creating Multiple Videos of a Dataset
    • Cloninig Settings and Running Coarse-graining for Multiple Scenarios
    • Automating EDEM Simulations runs and Iota Analyses
Powered by GitBook
On this page
  • Methods
  • export_html(output_file,[layout])
  • get_axis_title()
  • get_data()
  • get_labels()
  • get_legend()
  • Static methods
  • default_export_layout()
  • export_plotly(file, data, [layout])

Was this helpful?

  1. Iota Python Reference Library

Graph

PreviousScenarioNextDataset

Last updated 5 years ago

Was this helpful?

iota.graph.Graph()

Description Iota graph object.

Methods

Static methods

Variables

  • description (str) user description

  • filepath (str) file containing the graph data (csv format)

  • name (str) graph name

Methods

Generate a html document, containing the plots for a graph

Arguments

  • output_file: (text) file path where the html graph will be saved

  • layout: (dict) layout used to generate the graph (Default: None)

Example

>>> 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]
                  )
            )
      )

Get xtitle,ytitle pair from the graph

Example

>>> xtitle,ytitle = my_graph.get_axis_title()
>>> print(xtitle)
timestep
>>> print(ytitle)
Solid Fraction

Get the raw underlying data of a graph return an OrderedDict of pairs { 'column_name' : ArrayFloat() }

Example

>>> 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]}
]

Returns list of labels of graph curves (xtitle and trace labels)

Example

>>> labels = my_graph.get_labels()
>>> print(labels)
['timestep','curve 1','curve 2']

Get the label of each trace in the graph

Example

>>> legends = my_graph.get_legend()
>>> print(legends)
['curve 1','curve 2']

Static methods

Returns the dictionary containing the default layout used if nothing defined by the user

Example

>>> layout = Graph.default_export_layout()
>>> print(layout)
{
  'width': 800,
  'height': 640
}

Generate a html graph file invoking directly plotly

Arguments

  • file: (text) file path where the html graph will be saved

  • data: (dict) data to be plotted

  • layout: (dict) layout used to generate the graph (Default: None)

Example

>>> 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
    )

export_html
get_axis_title
get_data
get_labels
get_legend
default_export_layout
export_plotly
export_html(output_file,[layout])
get_axis_title()
get_data()
get_labels()
get_legend()
default_export_layout()
export_plotly(file, data, [layout])