I am using plotly in R (R package version 4.9.2.1). I find that when I use a size argument in add_trace(), the opacity of the markers in the trace is reduced. This seems like a bug. Is it -- or am I just failing to understand add_trace()?
Here is a minimal example:
library(plotly)
myPlot <- plot_ly(data = data.frame(x = 1, y = 1, yLo = 0.5, yHi = 1.5))
myPlot <- add_trace(
myPlot,
x = ~x, y = ~y,
type = "scatter", mode = "markers",
size = 1000,
marker = list(
# size = 250,
# opacity = 1,
color = "D0D0D0",
line = list(color = "D0D0D0")))
add_segments(
myPlot,
x = ~x, xend = ~x, y = ~yLo, yend = ~yHi,
color = I("#D0D0D0"))
The code produces this image:
You can see that the opacity of the dot and the line differ, even though nothing in the code suggests that they should differ. (I have zoomed in on the dot to make this difference easy to see.)
There are at least three ways to fix the problem:
- Comment out
size = 1000. - Uncomment
size = 250in themarkerargument. - Uncomment
opacity = 1in themarkerargument.
If I do any of those, the dot is completely opaque, just as the line is.
Note that this difference in opacities doesn't seem to be a matter of the dot and the line having different defaults. If that were the case, we wouldn't be able to solve the problem by manipulating the size arguments.
Is the default behavior demonstrated here a bug?
