Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 巨蟒波基传说剪掉了。图例高度如何超过绘图高度?_Python_Legend_Bokeh - Fatal编程技术网

Python 巨蟒波基传说剪掉了。图例高度如何超过绘图高度?

Python 巨蟒波基传说剪掉了。图例高度如何超过绘图高度?,python,legend,bokeh,Python,Legend,Bokeh,我创建了一个带有图例的绘图,类似于文档中的示例 import numpy as np from bokeh.models import Legend from bokeh.plotting import figure, show, output_file x = np.linspace(0, 4*np.pi, 100) y = np.sin(x) output_file("legend_labels.html") p = figure(toolbar_location="above")

我创建了一个带有图例的绘图,类似于文档中的示例

import numpy as np
from bokeh.models import Legend
from bokeh.plotting import figure, show, output_file

x = np.linspace(0, 4*np.pi, 100)
y = np.sin(x)

output_file("legend_labels.html")

p = figure(toolbar_location="above")

r0 = p.circle(x, y)
r1 = p.line(x, y)

r2 = p.line(x, 2*y, line_dash=[4, 4], line_color="orange", line_width=2)

r3 = p.square(x, 3*y, fill_color=None, line_color="green")
r4 = p.line(x, 3*y, line_color="green")

legend = Legend(legends=[
    ("sin(x)",   [r0, r1]),
    ("2*sin(x)", [r2]),
    ("3*sin(x)", [r3, r4])
], location=(0, -30))

p.add_layout(legend, 'right')

show(p)

但在我的例子中,传奇故事高于情节,因此被切断。如何让图例高度超过绘图高度?

我在最近的开发版本中获得了正确的输出。你用的是什么版本?在任何帮助请求中始终包含版本信息总是很重要的。对不起,我使用的是python 2.7.12和bokeh 0.12.1。是的,这个例子很好用,我只是说它和我的很相似。我的代码中有很多数据集,因此图例变得很长,然后在超过绘图高度时被截断。如果在示例图形中添加一个非常小的高度,图例也将被截断。