2015-07-20 41 views
5

我在小情節之間有一個很大的空間。在matplotlib中,有一個叫做緊湊佈局的佈局可以消除這個問題。情節中有沒有類似的佈局?我正在繪製iPython筆記本,因此空間有限。請參閱下圖中的空格。在Plotly中刪除子圖之間的空間?

enter image description here

回答

14

是的,有!您可以使用specsvertical_spacinghorizontal_spacing。下面是horizontal_spacing一個例子:

from plotly import tools 
import plotly.plotly as py 
from plotly.graph_objs import * 

trace1 = Scatter(
    x=[1, 2, 3], 
    y=[4, 5, 6] 
) 
trace2 = Scatter(
    x=[20, 30, 40], 
    y=[50, 60, 70], 
) 

fig = tools.make_subplots(rows = 1, cols = 2, specs = [[{}, {}]], 
          horizontal_spacing = 0.05) 

fig.append_trace(trace1, 1, 1) 
fig.append_trace(trace2, 1, 2) 

py.iplot(fig, filename='make-subplot-horizontal_spacing') 

here is the plot

你可以找到Plotly次要情節頁面上更多的教程:Plotly subplots tutorial

+0

規格的細節並不清楚。是否有一個文檔頁面更詳細地解釋它? – wordsforthewise