Skip to main content
  1. Posts/

数据可视化资源

·132 words·1 min· loading · loading · ·
Author
Zhenda
tech - This article is part of a series.
Part : This Article

dash
#

官方文档: https://dash.plotly.com/tutorial

streamlit
#

官方文档: https://docs.streamlit.io/

plotly
#

官方文档: https://plotly.com/python/getting-started/

demo

import plotly.express as px

fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
# fig = px.pie(x=["a", "b", "c"], y=[1, 3, 2])
# fig = px.line(x=["a", "b", "c"], y=[1, 3, 2])
# fig = px.scatter(x=["a", "b", "c"], y=[1, 3, 2])

fig.show()
# write_html()

subplots demo

from plotly.subplots import make_subplots
import plotly.graph_objects as go

fig = make_subplots(
    rows=2, cols=2,
    specs=[[{"type": "xy"}, {"type": "polar"}],
           [{"type": "domain"}, {"type": "scene"}]],
)

fig.add_trace(go.Bar(y=[2, 3, 1]),
              row=1, col=1)

fig.add_trace(go.Barpolar(theta=[0, 45, 90], r=[2, 3, 1]),
              row=1, col=2)

fig.add_trace(go.Pie(values=[2, 3, 1]),
              row=2, col=1)

fig.add_trace(go.Scatter3d(x=[2, 3, 1], y=[0, 0, 0],
                           z=[0.5, 1, 2], mode="lines"),
              row=2, col=2)

fig.update_layout(height=700, showlegend=False)

fig.show()

matplotlib
#

官方文档: https://matplotlib.org/stable/index.html

tech - This article is part of a series.
Part : This Article