0
私はボケを試しています。それは今のところかなり面白いです。しかし、私は完全にそれのハングアップを取得していません。私の目標は、シンプルでインタラクティブな散布図を作成することです。私は散布は私が決めることができますどこでウィジェットを大好きだcolors
ボケのラベルと色のグリフ
names
- :
私は三つの主要な問題を抱えています色と名前が表示されている場合
ここまでは私がこれまで行ってきたことです。私はLabelSet
を使用しようとしましたが、私は立ち往生しています。どんな助けでも大歓迎です!
# interactive widget bokeh figure
from bokeh.io import curdoc
from bokeh.layouts import row, widgetbox
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import Slider, TextInput
from bokeh.plotting import figure
from bokeh.models import Range1d, LabelSet, Label
import numpy as np
# data
x = [-4, 3, 2, 4, 10, 11, -2, 6]
y = [-3, 2, 2, 9, 11, 12, -5, 6]
names = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
colors =['r', 'y', 'y', 'r', 'g', 'g', 'g', 'g']
p = figure(plot_height=400, plot_width=400, title="a little interactive chart",
tools="crosshair,pan,reset,save,wheel_zoom",
x_range=[-10, 10], y_range=[-10, 10])
labels = LabelSet(x='x', y='y', text='names', level='glyph',
x_offset=5, y_offset=5)
p.add_layout(labels)
p.circle(x, y, fill_color="red", line_color="red", size=6)
# Set up widgets
text = TextInput(title="title", value='a little interavtive chart')
# Set up callbacks
def update_title(attrname, old, new):
p.title.text = text.value
text.on_change('value', update_title)
# # Set up layouts and add to document
inputs = widgetbox(text, names)
curdoc().add_root(row(inputs, p, width=800))
curdoc().title = "Sliders"
うわー!ありがとうございました!はい、私は '選択 'を使用しようとしています。私はボケにはまったく新しいです。そのような初心者の質問を投稿して申し訳ありません!でも、しばらくそれをしなければならないでしょう... – Rachel
'fill_color =" red "' 'colors = colors'を上書きしませんか?私の考えは、 'colors'を使ってグリフを個別に塗りつぶすことでしたか? – Rachel
ああ...私は 'circle'で' colors'を渡す必要があります!ありがとうございました! – Rachel