r - 绘图标记大小

标签 r plotly

我无法使绘图标记大小正常工作。

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')

我添加了一个文本框,其中包含应该用作标记尺寸的列,并且它工作正常,因此任何有关尺寸问题的帮助将不胜感激。

最佳答案

希望这有帮助,其中大小由 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')

关于r - 绘图标记大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58155453/

相关文章:

r - 按顺序匹配向量

r - 根据图中的两个随机游走构建矩阵

python - 在Python中,绘制具有相同x轴和y轴的不同类别数据的方法是什么?

python - 如何使用 plotly figure_factory 仅绘制散点图矩阵的下半部分?

python - 将表单添加到 Dash/Plotly 应用程序

r - styleColorBar : have the size of the color bar be proportional to absolute values of a column

R:Quantstrat TxnFees 乘数

r - 我该如何正确处理管道?

R plotly x 轴字符/因子(组合数字和 -)。绘图仅显示仅包含数字的轴。漏洞?

r - ggplotly 未正确显示 geom_line