sensortoolkit.plotting._plot_formatting.wrap_text

wrap_text(labels, max_label_len=10)[source]

Formats plotting text with line breaks based on specified text length.

Code modified via Stack Overflow user DavidG code (https://stackoverflow.com/questions/47057789/matplotlib-wrap-text-in-legend)

Parameters
  • labels (list) – list plotting labels (strings) such as header/title text

  • max_label_len (int) – The maximum number of characters on a single line. Labels longer than this will have a newline character inserted at every max_label_len number of characters.

Returns

Modified list of labels with the newline character inserted for labels exceeding the max_label_len.

Return type

labels (list)