I've made a figure in plotly, e.g.:
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')
and the figure looks like:
I'd like an outline of the plot area like so:
but I am unable to figure it out from the plot.ly docs so far. Is this possible?
All you need is to find another well hidden Plotly attribute. In this case it is 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.
Add
mirror=True,
ticks='outside',
showline=True,
to your xaxis
and yaxis
dicts
and you get the following graph.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With