Plotly Express 是一个新的高级 Python 可视化库:它是 Plotly.py 的高级封装,它为复杂的图表提供了一个简单的语法。
用 pip install plotly_express 命令可以安装 Plotly Express。
import plotly_express as pxpx.scatter(gapminder2007, x='gdpPercap', y='lifeExp',color='continent',size='pop',size_max=60,hover_name='country')
px.scatter(gapminder2007, x='gdpPercap', y='lifeExp',color='continent',size='pop',size_max=60,hover_name='country',facet_col ='continent',log_x=True)
px.scatter(gapminder, x='gdpPercap', y='lifeExp', color='continent', size='pop', size_max=60, hover_name='country', animation_frame='year', animation_group='country', log_x=True, range_x=[10,100000], range_y=[25,90], labels=dict(pop='Population', gdpPercap='GDP per Capita', lifeExp='Life Expectancy'))
px.choropleth(gapminder, locations='iso_alpha', color='lifeExp', hover_name='country', animation_frame='year', color_continuous_scale=px.colors.sequential.Plasma, projection='natural earth')
iris = px.data.iris()px.scatter(iris, x='sepal_width', y='sepal_length', color='species', marginal_y='histogram', marginal_x='box', trendline='ols')
tips = px.data.tips()px.scatter(tips, x='total_bill', y='tip',facet_row='time', facet_col='day',color='smoker',trendline='ols', category_orders={'day':['Thur', 'Fri', 'Sat', 'Sun'], 'time':['Lunch', 'Dinner']})
px.parallel_coordinates(iris, color='species_id', color_continuous_scale=px.colors.diverging.Tealrose, color_continuous_midpoint=2)
px.parallel_categories(tips, color="size", color_continuous_scale=px.colors.sequential.Inferno)
px.density_contour(iris, x="sepal_width", y="sepal_length")
px.density_contour(iris, x="sepal_width", y="sepal_length", color="species")
px.histogram(tips, x="total_bill", color="smoker", facet_row="day", facet_col="time")
px.box(tips, y="tip", x="sex", color="smoker", facet_col="day", facet_row="time", category_orders={"day": ["Thur", "Fri", "Sat", "Sun"], "time": ["Lunch", "Dinner"]})
px.violin(tips, y="tip", x="sex", color="smoker", facet_col="day", facet_row="time", category_orders={"day": ["Thur", "Fri", "Sat", "Sun"], "time": ["Lunch", "Dinner"]})
election = px.data.election()px.scatter_ternary(election, a="Joly", b="Coderre", c="Bergeron", color="winner", size="total", hover_name="district", symbol="result", size_max=15, color_discrete_map = {"Joly": "blue", "Bergeron": "green", "Coderre":"red"} )
px.scatter_3d(election, x="Joly", y="Coderre", z="Bergeron", color="winner", size="total", hover_name="district", symbol="result", color_discrete_map = {"Joly": "blue", "Bergeron": "green", "Coderre":"red"})
px.bar_polar(wind, r="value", theta="direction", color="strength", template="plotly_dark", color_discrete_sequence= px.colors.sequential.Plotly[-2::-1])
px.scatter_matrix(iris, dimensions=["sepal_width", "sepal_length", "petal_width", "petal_length"], color="species")
px.parallel_coordinates(iris, color='species_id', color_continuous_scale=['red','green', 'blue'])
import plotly_express as pxfig = px.scatter(px.data.iris(), x='sepal_width', y='sepal_length', color='species')import plotly.graph_objs as gofig.update(layout=dict(legend=dict(orientation='h',y=1.1,x=0.5), annotations=[go.layout.Annotation(text='this one is interesting', x=3.6, y=7.2)]))
最新聚合影视APP安卓 / IOS 影视双端 完美运行 无限代销系统代后端
智能用电小程序前端源码/小程序模板
最新版AI创意二维码小程序代部署 免服务器,免域名,包部署,全套一条龙配置上线!大厂服务器,性能强劲
C# TextBox中只允许输入数字的解决方法
桶装水配送多水站门店骑手小程序
蓝星代刷网源码 附带商品详细视频教程
Eyoucms版 企业网站建设推广类网站易优模板(带移动端)
乐秀V9.22直装解锁会员版下载
【毕设】asp.net254社团网站毕业设计
响应式智能科技设施类网站织梦模板(自适应移动端)