autowisp.browser_interface.core.plot_utils module

Class Inheritance Diagram

Inheritance diagram of JsonResponse, StringIO

Shared plot constants and utilities for BUI views.

autowisp.browser_interface.core.plot_utils.figure_to_svg_response(fig, **extra)[source]

Serialize a matplotlib figure to SVG and return a JsonResponse.

Parameters:
  • fig – The matplotlib Figure to serialize and close.

  • **extra – Additional key/value pairs to include in the JSON response alongside plot_data.

Returns:

JsonResponse with plot_data containing the SVG string.

autowisp.browser_interface.core.plot_utils.line_styles = {'-': '-', ':': ':', '|': '--'}

The styles that draw a series as a curve through its points rather than as points, which is what a smoothed quantity wants over the raw one it smooths.

Keyed by the character the style menu is written with, and holding the linestyle matplotlib draws for it. The menu is a string walked one character at a time, so each style needs a character of its own, and matplotlib spells dashed with two – hence | standing for it here rather than the style passing straight through. | is a marker to matplotlib, so nothing may hand one of these keys to it unmapped.

autowisp.browser_interface.core.plot_utils.setup_svg_matplotlib()[source]

Configure matplotlib to render SVG with dark background.