Python 绘声绘色地勾选标签
我正在尝试在plotly中的y轴上设置自定义标签 我的布局就是这样的:Python 绘声绘色地勾选标签,python,python-3.x,plotly,Python,Python 3.x,Plotly,我正在尝试在plotly中的y轴上设置自定义标签 我的布局就是这样的: layout = dict(title = 'Tracer', dragmode = 'zoom', showlegend = True, yaxis = dict( tickvals = yTickValues,
layout = dict(title = 'Tracer',
dragmode = 'zoom',
showlegend = True,
yaxis = dict(
tickvals = yTickValues,
ticktext = yTickNames,
showticklabels = True,
),
)
标签['rHandlerI2C'、'OrganizedTsSp0'、'PIN_INT5_IRQn']的格式错误
实验中,我发现“RwHandlerI2c”标签的问题在于数字“2”,名为“RwHandlerIc”的标签正确显示。我在格式化方面有什么损失吗?以及如何为标签创建单独的列,以便它们不会与绘图重叠
你能把你的价值也加进去吗?i、 e.
yTickValues
、yTickNames
和您的x
和y
值。@Maximilian参数我已经用一个错误标签在我的问题中添加了一个示例代码示例代码您的示例代码生成的图形对我来说还可以:您也可以添加您的值吗?i、 e.yTickValues
、yTickNames
以及您的x
和y
值。@Maximilian参数我已使用错误标签向问题中添加了一个示例代码示例代码您的示例代码生成的图形对我来说还行:
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import datetime
yTickValues = list(range(8))
yTickNames = ['StartSendingSsp0', 'OrganizedTxSsp0', 'I2cRwHandler', 'GpsParser', 'SSP1_IRQn', 'USART0_IRQn', 'RTC_IRQn', 'I2C_IRQn']
xaxis = [datetime.datetime(2000, 1, 1, 0, 0, 0, 686002),
datetime.datetime(2000, 1, 1, 0, 0, 0, 686008),
datetime.datetime(2000, 1, 1, 0, 0, 0, 686045),
datetime.datetime(2000, 1, 1, 0, 0, 0, 686176),
datetime.datetime(2000, 1, 1, 0, 0, 0, 686192),
datetime.datetime(2000, 1, 1, 0, 0, 0, 686523),
datetime.datetime(2000, 1, 1, 0, 0, 0, 686530)]
yaxis = list(range(8))
# Create a trace
trace = go.Scatter(
x = xaxis,
y = yaxis,
mode = 'markers'
)
layout = dict(title = 'Tracer',
yaxis = dict(
tickvals = yTickValues,
ticktext = yTickNames,
showticklabels = True,
)
)
data = [trace]
fig = dict(data=data, layout=layout)
plot(fig, filename='example')