1
0

matplotlib_documentation.py 334 B

1234567891011121314151617
  1. from nicegui import ui
  2. from . import doc
  3. @doc.demo(ui.matplotlib)
  4. def main_demo() -> None:
  5. import numpy as np
  6. with ui.matplotlib(figsize=(3, 2)).figure as fig:
  7. x = np.linspace(0.0, 5.0)
  8. y = np.cos(2 * np.pi * x) * np.exp(-x)
  9. ax = fig.gca()
  10. ax.plot(x, y, '-')
  11. doc.reference(ui.matplotlib)