Plotting API#

h_transport_materials.plotting.get_prop_to_color(group: PropertiesGroup, colour_by: str, key_to_colour: dict = None, colour_cycle: list = None)[source]#

Returns a dictionary mapping Property objects to a colour based on a property attribute

Parameters:
  • group (PropertiesGroup) – a group of properties

  • colour_by (str) – a property attribute to colour by (eg. “author”, “isotope”, “material”)

  • key_to_colour (dict, optional) – a dictionary with keys (eg. material) corresponding to colours. Defaults to None

  • colour_cycle (list, optional) – a list of colours used if colour_by is key_to_colour is not given

Returns:

a dictionary mapping properties to colours

Return type:

dict

h_transport_materials.plotting.legend(**kwargs)[source]#

Adds a legend to an existing plot. Should be used in combination with htm.plotting.plot(PropertiesGroup)

h_transport_materials.plotting.plot(prop: Property | PropertiesGroup, T_bounds=(300, 1200), inverse_temperature=True, auto_label=True, show_datapoints=True, scatter_kwargs={}, colour_by='property', key_to_colour=None, **kwargs)[source]#

Plots a Property object on a temperature plot

Parameters:
  • prop (Property or PropertiesGroup) – the property (or group of properties) to plot.

  • T_bounds (tuple, optional) – If the property doesn’t have a temperature range, this range will be used. Defaults to (300, 1200).

  • inverse_temperature (bool, optional) – If True, the x axis will be the inverse temperature (in K^-1). Defaults to True.

  • auto_label (bool, optional) – If True, a label will be automatically generated from the isotope, author and year. Ignored if label is set in kwargs. Defaults to True.

  • show_datapoints (bool, optional) – If True, the experimental datapoints will be scattered too. Defaults to True.

  • scatter_kwargs (dict, optional) – other matplotlib.pyplot.scatter arguments. Defaults to {}.

  • colour_by (str, optional) – a property attribute to colour by (eg. “author”, “isotope”, “material”). Defaults to “property”.

  • key_to_colour (dict, optional) – a dictionary with keys (eg. material) corresponding to colours. Defaults to None

  • kwargs – other matplotlib.pyplot.plot arguments

Returns:

the Line2D artist

Return type:

matplotlib.lines.Line2D

h_transport_materials.plotting.plot_plotly(group_of_properties: PropertiesGroup, T_bounds=(300, 1200), colour_by='property', show_datapoints=True, line_kwargs={}, scatter_kwargs={})[source]#

Creates a plotly graph for visualising properties.

Parameters:
  • group_of_properties (list) – a group of properties

  • T_bounds (tuple, optional) – If the property doesn’t have a temperature range, this range will be used. Defaults to (300, 1200).

  • colour_by (str, optional) – “property”, “material”, “isotope”, “author”. Defaults to “property”.

  • show_datapoints (bool, optional) – If True, the experimental datapoints will be scattered too. Defaults to True.

  • line_kwargs (dict, optional) – the keywords args for line. Defaults to {}.

  • scatter_kwargs (dict, optional) – the keywords args for marker. Defaults to {}.

Returns:

the graph

Return type:

go.Figure