简体   繁体   English

绘制坐标轴粗细不正常的图形[Python]

[英]Plotly plot axis line thickness not behaving [Python]

When I try to increase the x-axis thickness, plotly overlays a new axis line (of the desired thickness), instead of just increasing the thickness of the existing axis line. 当我尝试增加x轴的厚度时,请以图形方式覆盖新的轴线(具有所需的厚度),而不是仅仅增加现有轴线的厚度。 Am I doing something wrong? 难道我做错了什么? For example if I edit the layout property 'xaxis':{'linewidth':3}, it produces a new line under the xaxis (above the xlabels) which has width of 3, but it looks bad obviously. 例如,如果我编辑布局属性'xaxis':{'linewidth':3},它将在xaxis下方(在xlabels上方)产生一条宽度为3的新行,但是看起来很糟糕。 What can I do about this? 我该怎么办? I've tried by editing 'zerolinewidth':3 as well but this does nothing. 我也尝试通过编辑'zerolinewidth':3来尝试,但这无济于事。

Here's an example code with the issue reproduced - if we remove the xaxis property 'linewdith':3 in the layout dict then the plot is default. 这是一个复制了问题的示例代码-如果我们在布局字典中删除xaxis属性'linewdith':3,则该图为默认设置。 I just want control over the axis linewidth. 我只想控制轴的线宽。

# Example axis problem
import plotly.offline as pyo
from plotly.graph_objs import *
from plotly import tools
import plotly.plotly as py
pyo.offline.init_notebook_mode()

xdata = list(range(6))
ydata = [0, .2, .4, .6, .8, 1]

trace1 = {'type':'scatter',
     'x':xdata,
     'y':ydata,
     'mode':'markers+lines'}

layout = {'title':'some plot',
     'xaxis':{'title':'x-axis',
             'linewidth':3},
     'yaxis':{'title':'y-axis'}}

data = Data([trace1])

fig = Figure(data=data, layout=layout)

pyo.iplot(fig)

linewidth specifies the line width of the frame around the graph, see here for an example. linewidth指定图形周围框架的linewidth ,请参见此处的示例。

You are probably looking for zerolinewidth . 您可能正在寻找zerolinewidth

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM