display#

openalea.hydroroot.display.get_root_visitor(prune=None, factor=10000.0)[source]#

Turtle going through the architecture used in plot() and get_root_visitor_with_point() Root angles are dummy values to get better display in 3D

Parameters:
  • prune – (float) - distance from base after witch the MTG is no longer read (Default value = None)

  • factor – (float) - a factor apply to length and radius properties (Default value = 1.0e4)

For example:

if the MTG vertices length is 0.1 mm (1.0e-4 m), then if we want to set each vertex as a dot (let say a pixel) we have to multiply length by 1/1e-4 is useful for plot

openalea.hydroroot.display.get_root_visitor_with_point(prune=None, factor=10000.0)[source]#

Get 3D position of root segment by using turtle in get_root_visitor() Create a new property position3d = [x,y,z] coordinate needed for example to export MTG in RSML format see hydroroot.hydro_io.export_mtg_to_rsml()

Parameters:
  • prune – (float) - distance from base after witch the MTG is no longer read (Default value = None)

  • factor – (float) a factor apply to property length (Default value = 1.0e4)

Note

the 3D coordinate are calculated from a virtual 3D representation with imaginary angles. Therefore, the resulting 3D coordinate are dummy values.

openalea.hydroroot.display.mtg_scene(g, has_radius=False, r_base=0.0001, r_tip=5e-05, visitor=None, prop_cmap='radius', cmap='jet', lognorm=False, min=None, max=None, prune=None, factor=10000.0)[source]#

Build scene of a MTG to be displayed in 3D plantgl viewer (openalea/plantgl)

Parameters:
  • g – (MTG)

  • has_radius – (boolean) - if True use the ‘radius’ property otherwise compute the radius (hydroroot.radius.discont_radius()) (Default value = False)

  • r_base – (float) - radius (m) at the base to use if the radius property is computed (Default value = 1.e-4)

  • r_tip – (float) - radius (m) at the tip to use if the radius property is computed (Default value = 5e-5)

  • visitor – Turtle going through the architecture see get_root_visitor() (Default value = None)

  • prop_cmap – (string) property used for the color map (Default value = ‘radius’)

  • cmap – matplotlib color map (Default value = ‘jet’)

  • lognorm – (boolean) - if None no normalization, if False linear normalization, if True log normalization (Default value = False)

  • min – (float) - if not None, the minimum used for the colormap normalization (Default value = None)

  • max – (float) - if not None, the maximum used for the colormap normalization (Default value = None)

  • prune – (float) - distance from base after witch the MTG is no longer read (Default value = None)

Returns:

a plantgl Scene

openalea.hydroroot.display.my_colormap(g, property_name, cmap='jet', lognorm=False, min=None, max=None)[source]#

Compute the property ‘color’ based on a given property and a colormap.

Parameters:
  • g – (MTG)

  • property_name – (string) - the property to display with the heatmap

  • cmap – (string) - the color map name (https://matplotlib.org/stable/tutorials/colors/colormaps.html) (Default value = ‘jet’)

  • lognorm – if True Normalize to the 0-1 range on a log scale, if False on a linear scale (Default value = False)

  • min – (float) - if not None, the minimum used for normalization (Default value = None)

  • max – (float) - if not None, the maximum used for normalization (Default value = None)

Returns:

  • g (MTG) with the property ‘color’ set

Note

This is the function openalea.mtg.plantframe.color.colormap modified to add the possibility to fix the min-max for normalization and so the possibility to compare two MTG with different min-max but the same colormap

openalea.hydroroot.display.plot(g=None, min=None, max=None, name=None, cmap='jet', **kwds)[source]#

Display the MTG g in 3D see mtg_scene()

Parameters:
  • g – (MTG) - the mtg to plot (Default value = None)

  • min – (float) - the minimum used for normalization (Default value = None)

  • max – (float) - the maximum used for normalization (Default value = None)

  • name – (string) - if not None save the plot to name (Default value = None)

  • cmap – (string) - the color map name (https://matplotlib.org/stable/tutorials/colors/colormaps.html) (Default value = ‘jet’)

  • kwds – see mtg_scene()

openalea.hydroroot.display.property_scale_bar(g, property_name, cmap='jet', lognorm=False, vmin=None, vmax=None, format=None)[source]#

display a color scale bar based on the property_name values

Parameters:
  • g – (MTG)

  • property_name – (string) - the property name

  • cmap – (string) - the color map name (Default value = ‘jet’)

  • lognorm – (boolean) - if True Normalize to the 0-1 range on a log scale (Default value = False)

  • min – (float) - if not None the scale minimum (Default value = None)

  • max – (float) - if not None the scale maximum (Default value = None)

  • format – (string) - format for tick labes, e.i. ‘%.2f’ (Default value = None)

Download the source file ../../src/openalea/hydroroot/display.py.