如何将条形轮廓添加到r Plotly bar图表中?
我正在创建一个基于变量类别编码的单个条形图的情节图表。我在将棒的颜色分类的同时,在钢筋上添加黑色轮廓很难。
以下是我当前的代码。我需要添加什么才能在每个栏上包含一个黑色轮廓?谢谢。
library(plotly)
library(tidyverse)
my_tibble <- tibble(mins = runif(10,10,30),
week = 1:10,
exercise = c("a", "b", "b", "b", "a", "a", "b", "b", "b", "a"))
example_hex <- c('#70AD47', '#404040', '#CAE1F1', '#24608B')
plot_ly(
data = my_tibble,
type = 'bar',
x = ~week,
y = ~mins,
color = ~exercise,
colors = example_hex)
I am creating a plotly chart with individual bars coded based on a variable category. I am having trouble adding a black outline to the bars while keeping the bars' color categorization.
Below is my current code. What do I need to add to include a black outline on each bar? Thank you.
library(plotly)
library(tidyverse)
my_tibble <- tibble(mins = runif(10,10,30),
week = 1:10,
exercise = c("a", "b", "b", "b", "a", "a", "b", "b", "b", "a"))
example_hex <- c('#70AD47', '#404040', '#CAE1F1', '#24608B')
plot_ly(
data = my_tibble,
type = 'bar',
x = ~week,
y = ~mins,
color = ~exercise,
colors = example_hex)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标记
参数是您所追求的。输出:
The
marker
parameter is what you are after.Output: