r - Plotly marker size
问题描述
I am having trouble getting the plotly marker size to work correctly.
test <- data.frame(a = c(1,2,3,5,3,4,2,6,4,5),
b = c(12,14,11,10,3,7,5,8,15,2),
c = c("d","e","d","f","e","d","f","e","e","f"),
d = c(5,5,10,15,10,15,5,10,5,15))
plot_ly()%>%
add_trace(data = test, x = ~a, y = ~b, mode = 'markers', type = 'scatter',
color = ~c, colors = c("red", "blue", "green"),
marker = list(size = ~d), text = ~d, hoverinfo = 'text')
I added a text box with the column that is supposed to be used as the marker size and it works correctly, so any help with what is going wrong with the size would be appreciated.
解决方案
希望这会有所帮助,其中尺寸由以下定义d
:
test <- data.frame(a = c(1,2,3,5,3,4,2,6,4,5),
b = c(12,14,11,10,3,7,5,8,15,2),
c = c("d","e","d","f","e","d","f","e","e","f"),
d = c(5,5,10,15,10,15,5,10,5,15))
plot_ly()%>%
add_trace(data = test, x = ~a, y = ~b, mode = 'markers', type = 'scatter',
color = ~c, colors = c("red", "blue", "green"),
size = ~d, text = ~d, hoverinfo = 'text')
推荐阅读
- javascript - Adobe-DTM,在数据元素自定义脚本中拆分数据层变量
- javascript - 无法对未安装的组件执行 React 状态更新。这是一个无操作 - Mob X 相关
- java - vscode+java+windows:我想在没有Maven的情况下导入和使用org.apache.logging.log4j.Logger
- arrays - 将数组粘贴到表格中的某些行和列
- reactjs - 如何在数据重新加载时修复 amcharts 缩放重置
- node.js - 为什么 Chrome 会在几分钟未收到响应后刷新 URL?
- java - 愚蠢的问题:PlayerView 和 SimpleExoPlayerView 有什么区别?
- mongodb - 我们可以在 mongo shell 中使用回调吗?
- javascript - 如何连接两个 JavaScript 项目
- url - 从 URL 中提取特定的参考 ID