分段图的虚线可以由源数据定义吗? [英] Can the line dash of a segment plot be defined by source data?

查看:71
本文介绍了分段图的虚线可以由源数据定义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

分段图的line_dash参数可以取决于源数据吗?

Can the line_dash parameter of a segment plot depend on the source data?

data = {}
data["dash"] = ["dashed","dashed","solid"]
data["x0"] = [0,1,2]
data["x1"] = [5,6,8]
data["y0"] = [1,1,1]
data["y1"] = [2,1,2]
source = bokeh.models.ColumnDataSource(data)
plot.segment(x0="x0", y0="y0", x1="x1", y1="y1", line_dash="dash", source=source)

返回

ValueError:预期为Enum('solid', '虚线','虚线','虚线','虚线'), Regex('^(\ d +(\ s + \ d +)*)?$')或Seq(Int),得到破折号"

ValueError: expected an element of either Enum('solid', 'dashed', 'dotted', 'dotdash', 'dashdot'), Regex('^(\d+(\s+\d+)*)?$') or Seq(Int), got 'dash'

line_dash属性只能设置为一个值吗?我怎么知道哪些参数可以本地"设置,哪些参数可以全局"设置?

Can the line_dash property be only set to one value? How do I know which parameters can be set "locally" and which have to be set "globally"?

推荐答案

line_dash属性目前无法像许多其他属性(例如颜色,alpha,位置等)那样矢量化".您可以在参考指南中查找 Segment.line_dash ,然后查看其属性类型为DashPattern.所有可矢量化的属性的类型名称中都将带有"Spec",例如

The line_dash property is not currently "vectorizable" in the way that many other properties (e.g. color, alpha, position, etc.) are. You can look in the Reference Guide for Segment.line_dash and see that its property type is DashPattern. All the properties that are vectorizable will have "Spec" in the type name, e.g Segment.line_alpha has a property type NumberSpec, so that indicates that you can set the alpha value to either one number, or it can refer to a list of numbers in a ColumnDataSource to vectorize different alphas.

这种情况有可能改变,从来没有任何明显的需求,因此没有优先考虑.随时提出 Github功能请求问题以进行进一步讨论.

It's possible this situation could be change, there has just never been any evident demand for it, so it was not prioritized. Feel free to make a Github feature request issue to discuss further.

这篇关于分段图的虚线可以由源数据定义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆