def plot(a):
panels = a.rotated_panel_positions
x = [x['x'] for x in panels]
y = [x['y'] for x in panels]
ids = [x['panelId'] for x in panels]
angles = [x['o'] for x in panels]
pad_x = (max(x) - min(x)) * .1
pad_y = (max(y) - min(y)) * .1
output_file('plot.html')
plot = figure(x_range=(min(x) - pad_x, max(x) + pad_x),
y_range=(min(y) - pad_y, max(y) + pad_y))
source = ColumnDataSource(dict(x=x, y=y, text=ids))
plot.triangle(x, y, angle=angles, angle_units='deg', size=70, color='#cccccc', fill_color=None, line_width=4)
glyph = Text(x='x', y='y', text='text', angle=0, text_align='center', text_color='#FF0000')
plot.add_glyph(source, glyph)
show(plot)
评论列表
文章目录