2014-10-08 14 views
18

क्या किसी को पता है कि ग्राफ के के बाहर बोके में किंवदंती कैसे लेनी है? का उपयोग करबोके प्लॉट में पौराणिक कथाओं की स्थिति

top_right, top_left, bottom_left or bottom_right 

: केवल हेरफेर मैं कर सकता के बीच एक स्थान का चयन करने के लिए था

legend()[0].orientation = "bottom_left" 

और जब मैं अलग-अलग करने की कोशिश मैं त्रुटि संदेश मिलता है:

ValueError: invalid value for orientation: 'outside'; allowed values are top_right, top_left, bottom_left or bottom_right 
+0

एक और सवाल बारीकी से इस से संबंधित हैं: कैसे मूल कुल्हाड़ियों का पहलू अनुपात रखने के लिए? –

उत्तर

11

के रूप में बोके 0.12.4 केंद्रीय साजिश क्षेत्र के बाहर किंवदंतियों को स्थापित करना संभव है।

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(items=[ 
    ("sin(x)", [r0, r1]), 
    ("2*sin(x)", [r2]), 
    ("3*sin(x)", [r3, r4]) 
], location=(0, -30)) 

p.add_layout(legend, 'right') 

show(p) 

, स्थिति को समायोजित location=(dx, dy) में dx और dy को बदलने के लिए: यहाँ एक छोटी उदाहरण from the user's guide है।

enter image description here

+0

चार्ट एपीआई का उपयोग करते समय मैं ऐसा कैसे करूं? – kynan

+0

इसे लेआउट स्थान को स्थानांतरित करने की आवश्यकता होगी, जो इस समय करने के लिए तुच्छ नहीं है। मैं मेलिंग सूची में उस तरह का प्रश्न लाने का सुझाव दूंगा, क्योंकि यह कुछ प्रयोग और पीछे और आगे चर्चा करने के लिए चर्चा कर सकता है। – bigreddot

+0

मैंने [उस सुविधा के लिए एक मुद्दा दायर किया था] (https://github.com/bokeh/bokeh/issues/4941)। – kynan

संबंधित मुद्दे