在Python

时间:2017-02-07 17:32:35

标签: 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')

,图看起来像:

test figure

我喜欢这样的情节区域的轮廓:

outlined fig

但到目前为止我无法从plot.ly文档中找到它。这可能吗?

1 个答案:

答案 0 :(得分:4)

您只需要找到另一个隐藏的Plotly属性。在这种情况下,它是mirror

  

mirror (enumerated: True | "ticks" | False | "all" | "allticks" )

     

确定轴线或/和刻度是否镜像到相反的位置   绘图区的一侧。如果" True",则镜像轴线。如果   " ticks",轴线和刻度被镜像。如果"错误",镜像   是禁用。如果" all&#34 ;,轴线在所有共享轴上镜像   次要情节。如果" allticks",轴线和刻度将全部镜像   共享轴子图。

添加

mirror=True,
ticks='outside',
showline=True,

到您的xaxisyaxis dicts,即可获得以下图表。

enter image description here

相关问题