[英]Adding jitter or transparency to points in Highcharter scatter plot in R
我正在研究如何使用 Highcharter 库为 R 中的散点 plot 放置抖动参数或添加一些透明度。 我发现大部分代码都与 Javascript 有关。 但我正在寻找额外的参数,这样我的点就不会被过度绘制。
这是代码:
library(highcharter)
library(tidyverse)
clist %>%
hchart("scatter", hcaes(x = completion_rate, y = synergy_scores, group = course_code)) %>%
hc_xAxis(title = list(text = "Completion rate")) %>%
hc_yAxis(title = list(text = "Synergy score")) %>%
hc_tooltip(pointFormat ="<b> Synergy score: </b> {point.y} <br>") %>%
hc_title(text = "Courses with positive and negative Synergy scores")
资料: 这里
任何帮助表示赞赏。
您可以做的是使用states
,这意味着当您突出显示一个点时,其他点的opacity
会降低。 这是代码:
library(highcharter)
library(tidyverse)
clist %>%
hchart("scatter", hcaes(x = completion_rate, y = synergy_scores, group = course_code)) %>%
hc_xAxis(title = list(text = "Completion rate")) %>%
hc_yAxis(title = list(text = "Synergy score")) %>%
hc_tooltip(pointFormat ="<b> Synergy score: </b> {point.y} <br>") %>%
hc_title(text = "Courses with positive and negative Synergy scores") %>%
hc_plotOptions(series = list(states = list(inactive = list(opacity = 0.5))))
Output:
您可以看到,其他点的透明度低于突出显示的点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.