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

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

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

      1. 如何使用 plotly express 向折线图添加点或标记?

        How to add points or markers to line chart using plotly express?(如何使用 plotly express 向折线图添加点或标记?)
        <legend id='PUwds'><style id='PUwds'><dir id='PUwds'><q id='PUwds'></q></dir></style></legend>
        <tfoot id='PUwds'></tfoot>
          <tbody id='PUwds'></tbody>
        <i id='PUwds'><tr id='PUwds'><dt id='PUwds'><q id='PUwds'><span id='PUwds'><b id='PUwds'><form id='PUwds'><ins id='PUwds'></ins><ul id='PUwds'></ul><sub id='PUwds'></sub></form><legend id='PUwds'></legend><bdo id='PUwds'><pre id='PUwds'><center id='PUwds'></center></pre></bdo></b><th id='PUwds'></th></span></q></dt></tr></i><div id='PUwds'><tfoot id='PUwds'></tfoot><dl id='PUwds'><fieldset id='PUwds'></fieldset></dl></div>
          <bdo id='PUwds'></bdo><ul id='PUwds'></ul>

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

                • 本文介绍了如何使用 plotly express 向折线图添加点或标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  plotly.express 非常方便生成漂亮的交互式绘图.下面的代码生成按国家/地区着色的折线图.现在我需要在情节中添加点.有谁知道我如何向折线图添加点?

                  将 plotly.express 导入为 pxgapminder = px.data.gapminder().query("大陆=='大洋洲'")fig = px.line(gapminder, x="year", y="lifeExp", color='country')图.show()

                  解决方案

                  更新:

                  截至版本

                  代码:

                  将 plotly.express 导入为 pxgapminder = px.data.gapminder().query("continent=='Oceania'")fig = px.line(gapminder, x="year", y="lifeExp", color='country')fig.update_traces(mode='markers+lines')图.show()

                  plotly.express is very convenient to produce nice interactive plots. The code below generates a line chart colored by country. Now what I need is to add points to the plot. Does anyone know how I can add points to the line chart?

                  import plotly.express as px
                  
                  gapminder = px.data.gapminder().query("continent=='Oceania'")
                  fig = px.line(gapminder, x="year", y="lifeExp", color='country')
                  fig.show()
                  

                  解决方案

                  Update:

                  As of version 5.2.1 you can use markers=True in:

                  px.line(df, x='year', y='lifeExp', color='country', markers=True)
                  

                  Previous answer for older versions:

                  Use fig.update_traces(mode='markers+lines')

                  Plot:

                  Code:

                  import plotly.express as px
                  
                  gapminder = px.data.gapminder().query("continent=='Oceania'")
                  fig = px.line(gapminder, x="year", y="lifeExp", color='country')
                  
                  fig.update_traces(mode='markers+lines')
                  fig.show()
                  

                  这篇关于如何使用 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 数据框制作线图?)

                  <legend id='0iMry'><style id='0iMry'><dir id='0iMry'><q id='0iMry'></q></dir></style></legend>

                  <small id='0iMry'></small><noframes id='0iMry'>

                    • <bdo id='0iMry'></bdo><ul id='0iMry'></ul>

                    • <i id='0iMry'><tr id='0iMry'><dt id='0iMry'><q id='0iMry'><span id='0iMry'><b id='0iMry'><form id='0iMry'><ins id='0iMry'></ins><ul id='0iMry'></ul><sub id='0iMry'></sub></form><legend id='0iMry'></legend><bdo id='0iMry'><pre id='0iMry'><center id='0iMry'></center></pre></bdo></b><th id='0iMry'></th></span></q></dt></tr></i><div id='0iMry'><tfoot id='0iMry'></tfoot><dl id='0iMry'><fieldset id='0iMry'></fieldset></dl></div>

                        <tbody id='0iMry'></tbody>
                            <tfoot id='0iMry'></tfoot>