plotly - 这是出现在我的绘图图中的趋势线吗?
问题描述
如果我的代码看起来很糟糕,我对这一切真的很陌生,所以提前道歉。
我正在尝试绘制一个系列,每个“阶段”相互重叠(x 是分钟)。如果我单独绘制它们,它们看起来会找到,但是一旦我选择了多个阶段,就会在末尾出现一条添加线。不完全确定这是什么。
我正在使用的代码是;
dff.sort_values('Time')
# Create figure with secondary y-axis
fig = make_subplots(
specs=[[{"secondary_y": True}]])
# Add lines
trace1 = go.Scatter(x=dff['TimeLapse'],
y=dff['TPRate'],
name='TP',
mode='lines',
yaxis='y1')
trace2 = go.Scatter(x=dff['TimeLapse'],
y=dff['WHSLRRateusethis'],
name='SLR',
mode='lines',
yaxis='y2')
data = [trace2]
#LAYOUT of your graph
layout = go.Layout( legend=dict(
x=1.1,
y=.2,
traceorder="normal"),
autosize=False,
width=1200,
height=400,
title='Graphs',
xaxis=dict(
title='Time Lapse',
range=[0,60],
rangeslider=dict(
autorange=True)
),
yaxis2=dict(title='SLR+Annulus',
overlaying='y',
side='left',
range=[0,50])
font=dict(
family="Times New Roman",
size=12)
感谢任何能够提供帮助的人!
链接到原始数据 - https://raw.githubusercontent.com/chooseanothername/code/main/stack_sample.csv
解决方案
推荐阅读
- azure-data-factory - 复制数据“存储连接”强制在 ADF 中使用 Blob 存储,而不是 ADLS Gen2
- angular - 使用 CVA 的角度动态 FormArray,未传播子验证
- azure-virtual-machine - Azure VM 上出现意外错误 OutOfMemory,但有大约 47% 的可用内存
- r - 操作重复
- node.js - 无法从 Parse Server 中删除对象
- docker - 如何为 Docker 容器和 Docker 主机只使用一个 docker-maven-plugin 配置?
- javascript - 如何在两个按钮上输出两个不同的标签?
- java - RecyclerView 在 NestedScrollView 内时不动画
- mysql - MongoDB 将 Select from UNION 与 Group By 与 sum
- javascript - 在 rails 6 和 tailwind-CSS 中添加显示更多/更少按钮