Python 中 plotly 中的轮廓绘图区域
Outline plot area in plotly in Python
我在plotly里做了一个图,例如:
import plotly.plotly as py
import plotly.graph_objs as go
trace1 = go.Scatter(
x=[1, 2, 3, 4, 5, 6, 7],
y=[7, 6, 5, 4, 3, 2, 1]
)
trace2 = go.Scatter(
x=[1, 2, 3, 4, 5, 6, 7, 8],
y=[1, 2, 3, 4, 5, 6, 7, 8]
)
data = [trace1, trace2]
layout = dict(xaxis = dict(title = 'T (K)', showgrid=False, ticks='inside'),
yaxis = dict(title = 'normalized intensity', showgrid=False, ticks='inside'),
font=dict(size=18),
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, auto_open=True, filename='test_fig.png')
py.image.save_as(fig, filename='test_fig.png')
图形看起来像:
我想要这样的地块轮廓:
但到目前为止,我无法从 plot.ly 文档中找出答案。这可能吗?
你只需要找到另一个隐藏得很好的 Plotly 属性。在本例中为 mirror
.
mirror (enumerated: True | "ticks" | False | "all" | "allticks" )
Determines if the axis lines or/and ticks are mirrored to the opposite
side of the plotting area. If "True", the axis lines are mirrored. If
"ticks", the axis lines and ticks are mirrored. If "False", mirroring
is disable. If "all", axis lines are mirrored on all shared-axes
subplots. If "allticks", axis lines and ticks are mirrored on all
shared-axes subplots.
添加
mirror=True,
ticks='outside',
showline=True,
你的 xaxis
和 yaxis
dicts
你会得到下面的图表。
我在plotly里做了一个图,例如:
import plotly.plotly as py
import plotly.graph_objs as go
trace1 = go.Scatter(
x=[1, 2, 3, 4, 5, 6, 7],
y=[7, 6, 5, 4, 3, 2, 1]
)
trace2 = go.Scatter(
x=[1, 2, 3, 4, 5, 6, 7, 8],
y=[1, 2, 3, 4, 5, 6, 7, 8]
)
data = [trace1, trace2]
layout = dict(xaxis = dict(title = 'T (K)', showgrid=False, ticks='inside'),
yaxis = dict(title = 'normalized intensity', showgrid=False, ticks='inside'),
font=dict(size=18),
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, auto_open=True, filename='test_fig.png')
py.image.save_as(fig, filename='test_fig.png')
图形看起来像:
我想要这样的地块轮廓:
但到目前为止,我无法从 plot.ly 文档中找出答案。这可能吗?
你只需要找到另一个隐藏得很好的 Plotly 属性。在本例中为 mirror
.
mirror (enumerated: True | "ticks" | False | "all" | "allticks" )
Determines if the axis lines or/and ticks are mirrored to the opposite side of the plotting area. If "True", the axis lines are mirrored. If "ticks", the axis lines and ticks are mirrored. If "False", mirroring is disable. If "all", axis lines are mirrored on all shared-axes subplots. If "allticks", axis lines and ticks are mirrored on all shared-axes subplots.
添加
mirror=True,
ticks='outside',
showline=True,
你的 xaxis
和 yaxis
dicts
你会得到下面的图表。