<legend id='ig81m'><style id='ig81m'><dir id='ig81m'><q id='ig81m'></q></dir></style></legend>
    <bdo id='ig81m'></bdo><ul id='ig81m'></ul>
    1. <i id='ig81m'><tr id='ig81m'><dt id='ig81m'><q id='ig81m'><span id='ig81m'><b id='ig81m'><form id='ig81m'><ins id='ig81m'></ins><ul id='ig81m'></ul><sub id='ig81m'></sub></form><legend id='ig81m'></legend><bdo id='ig81m'><pre id='ig81m'><center id='ig81m'></center></pre></bdo></b><th id='ig81m'></th></span></q></dt></tr></i><div id='ig81m'><tfoot id='ig81m'></tfoot><dl id='ig81m'><fieldset id='ig81m'></fieldset></dl></div>

        <small id='ig81m'></small><noframes id='ig81m'>

      1. <tfoot id='ig81m'></tfoot>

        Plotly:如何使用 Plotly Express 组合散点图和线图?

        Plotly: How to combine scatter and line plots using Plotly Express?(Plotly:如何使用 Plotly Express 组合散点图和线图?)
          <tbody id='gt8CN'></tbody>

          1. <tfoot id='gt8CN'></tfoot><legend id='gt8CN'><style id='gt8CN'><dir id='gt8CN'><q id='gt8CN'></q></dir></style></legend>
              <i id='gt8CN'><tr id='gt8CN'><dt id='gt8CN'><q id='gt8CN'><span id='gt8CN'><b id='gt8CN'><form id='gt8CN'><ins id='gt8CN'></ins><ul id='gt8CN'></ul><sub id='gt8CN'></sub></form><legend id='gt8CN'></legend><bdo id='gt8CN'><pre id='gt8CN'><center id='gt8CN'></center></pre></bdo></b><th id='gt8CN'></th></span></q></dt></tr></i><div id='gt8CN'><tfoot id='gt8CN'></tfoot><dl id='gt8CN'><fieldset id='gt8CN'></fieldset></dl></div>
              • <small id='gt8CN'></small><noframes id='gt8CN'>

                  <bdo id='gt8CN'></bdo><ul id='gt8CN'></ul>
                  本文介绍了Plotly:如何使用 Plotly Express 组合散点图和线图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Plotly Express 有一种直观的方式,可以用最少的代码行提供预先格式化的绘图;有点像 Seaborn 是如何为 matplotlib 做的.

                  可以在 Plotly 上添加绘图轨迹,以在现有线图上获得散点图.但是,我在 Plotly Express 中找不到这样的功能.

                  是否可以在 Plotly Express 中结合散点图和折线图?

                  解决方案

                  你可以使用:

                  fig3 = go.Figure(data=fig1.data + fig2.data)

                  fig1fig2 是使用

                  Plotly Express has an intuitive way to provide pre-formatted plotly plots with minimal lines of code; sort of how Seaborn does it for matplotlib.

                  It is possible to add traces of plots on Plotly to get a scatter plot on an existing line plot. However, I couldn't find such a functionality in Plotly Express.

                  Is it possible to combine a scatter and line graph in Plotly Express?

                  解决方案

                  You can use:

                  fig3 = go.Figure(data=fig1.data + fig2.data)
                  

                  Where fig1 and fig2 are built using px.line() and px.scatter(), respectively. And fig3 is, as you can see, built using plotly.graph_objects.

                  Some details:

                  One approach that I use alot is building two figures fig1 and fig2 using plotly.express and then combine them using their data attributes together with a go.Figure / plotly.graph_objects object like this:

                  import plotly.express as px
                  import plotly.graph_objects as go
                  df = px.data.iris()
                  
                  fig1 = px.line(df, x="sepal_width", y="sepal_length")
                  fig1.update_traces(line=dict(color = 'rgba(50,50,50,0.2)'))
                  
                  fig2 = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
                  
                  fig3 = go.Figure(data=fig1.data + fig2.data)
                  fig3.show()
                  

                  Plot:

                  这篇关于Plotly:如何使用 Plotly Express 组合散点图和线图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                  Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                  python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                  Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                  How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                  Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
                  <i id='AHfL9'><tr id='AHfL9'><dt id='AHfL9'><q id='AHfL9'><span id='AHfL9'><b id='AHfL9'><form id='AHfL9'><ins id='AHfL9'></ins><ul id='AHfL9'></ul><sub id='AHfL9'></sub></form><legend id='AHfL9'></legend><bdo id='AHfL9'><pre id='AHfL9'><center id='AHfL9'></center></pre></bdo></b><th id='AHfL9'></th></span></q></dt></tr></i><div id='AHfL9'><tfoot id='AHfL9'></tfoot><dl id='AHfL9'><fieldset id='AHfL9'></fieldset></dl></div>

                  1. <legend id='AHfL9'><style id='AHfL9'><dir id='AHfL9'><q id='AHfL9'></q></dir></style></legend>
                      <tbody id='AHfL9'></tbody>

                    <small id='AHfL9'></small><noframes id='AHfL9'>

                    <tfoot id='AHfL9'></tfoot>

                    • <bdo id='AHfL9'></bdo><ul id='AHfL9'></ul>