data visualization plotly入门

折线图

import plotly.express as px
import pandas as pd

df = px.data.stocks()

fig = px.line(
    df,
    x="date",
    y="GOOG",
    title="Google 股价走势"
)

fig.show()

交互式散点图

df = px.data.iris()

fig = px.scatter(
    df,
    x="sepal_width",
    y="sepal_length",
    color="species",
    size="petal_length",
    title="鸢尾花特征关系"
)

fig.show()