<small id='52pjz'></small><noframes id='52pjz'>

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

    <legend id='52pjz'><style id='52pjz'><dir id='52pjz'><q id='52pjz'></q></dir></style></legend>
    • <bdo id='52pjz'></bdo><ul id='52pjz'></ul>
    1. <tfoot id='52pjz'></tfoot>

      如何禁用 plotly.express.line 中的趋势线?

      时间:2023-09-28
        • <i id='BUKiV'><tr id='BUKiV'><dt id='BUKiV'><q id='BUKiV'><span id='BUKiV'><b id='BUKiV'><form id='BUKiV'><ins id='BUKiV'></ins><ul id='BUKiV'></ul><sub id='BUKiV'></sub></form><legend id='BUKiV'></legend><bdo id='BUKiV'><pre id='BUKiV'><center id='BUKiV'></center></pre></bdo></b><th id='BUKiV'></th></span></q></dt></tr></i><div id='BUKiV'><tfoot id='BUKiV'></tfoot><dl id='BUKiV'><fieldset id='BUKiV'></fieldset></dl></div>
            <bdo id='BUKiV'></bdo><ul id='BUKiV'></ul>

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

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

                <tfoot id='BUKiV'></tfoot>
                本文介绍了如何禁用 plotly.express.line 中的趋势线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我愿意在同一张图表上绘制 3 个时间序列.Datasource是一个pandas.DataFrame()对象,Timestamp的类型是datetime.date,3个不同的时间序列取自同一Value 列使用 plotly.express.line() 的颜色参数.

                I am willing to plot 3 timeseries on the same chart. Datasource is a pandas.DataFrame() object, the type of Timestamp being datetime.date, and the 3 different time series drawn from the same column Value using the color argument of plotly.express.line().

                图表上显示了 3 条线,但每条线都伴随着某种趋势线.我在函数签名中看不到如何禁用这些趋势线.你能帮忙吗?

                The 3 lines show on the chart, but each one is accompanied by some sort of trendline. I can't see in the function signature how to disable those trendlines. Can you please help?

                我已经做了几次尝试,例如使用另一个 color,但趋势线只是停留在那里.

                I have made several attempts, e.g. using another color, but the trendlines just stay there.

                请在下面找到代码片段和生成的图表.

                Please find below the code snippet and the resulting chart.

                import plotly.io as pio
                import plotly.express as px
                pio.renderers = 'jupyterlab'
                fig = px.line(data_frame=df, x='Timestamp', y='Value', color='Position_Type')
                fig.show()
                

                (如果相关,我正在使用 jupyterlab)

                (If relevant, I am using jupyterlab)

                屏幕上的时间戳如下所示(这是 [常规] 每周时间序列):

                Timestamp on the screen appears like this (this are [regular] weekly timeseries) :

                并且,根据类型:

                type(df.Timestamp[0])
                > datetime.date
                

                我要补充的是,我最初认为是趋势线的线看起来更像是从每个时间序列的第一个数据点到最后一个数据点的直线.

                I am adding that it looks like the lines that I first thought were trendlines would rather be straight lines from the first datapoint to the last datapoint of each time series.

                推荐答案

                df_melt = df_melt.sort_values('datetime_id')
                

                排序摆脱了那些环绕".感谢以上建议.使用 Plotly 4.8.2.

                Sorting got rid of those "wrap-arounds". Thanks for the suggestions above. Using Plotly 4.8.2.

                这篇关于如何禁用 plotly.express.line 中的趋势线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Plotly:如何重写标准仪表板应用程序以在 JupyterLab 中启动它? 下一篇:如何在 Python Plotly 中显示时间戳 x 轴

                相关文章

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

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

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