【发布时间】:2020-02-10 04:25:52
【问题描述】:
默认情况下,Plotly 图表的绘图区域边缘没有“线条”。
我可以在 X 轴和 Y 轴上定义线,但不能在所有绘图区域中定义。
在布局中使用"template": "simple_white",可以得到如下图。
import numpy as np
import plotly.graph_objs as go
x = np.linspace(0,10,1000)
y = np.sin(x)
layout = {"template":"simple_white"}
data = go.Scatter(x=x,y=y)
fig = go.Figure(data,layout)
fig.show()
使用 Plotly 获得的图像
有没有办法用 Plotly 获得像下面这样的图像,即在绘图区域周围有线条?
它是用 matplotlib 包制作的。我的意思是:我可以有这样的图像,但使用 Plotly 包吗?
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,10,1000)
y = np.sin(x)
plt.plot(x,y)
plt.show()
使用 Matplotlib 获得的图像
编辑:
可以在以下位置找到类似的问题:
Plotly: How to add borders and sidelabels to subplots, and syncronize panning?
但是,我想为其他用户维护这个,因为它直接到将边界放在一个情节中的地步。另一个问题包括其他功能。
【问题讨论】:
标签: python matplotlib plotly plotly-python