functionΒΆ

test_func.py

import plotly.express as px


def func():
    return px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])

Source:

.. plotly:: examples/test_func.py func

Output:

import plotly.express as px


def func():
    return px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])

(Source code, html)