You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ggplot2 point fill doesn't translate correctly #1234
As an alternative work around I changed the points from fill to color and then increased the stroke enough that the circle gets coloured in. Shouldn't need the development version or the plotly code.
`geom_point(data=someDF, aes(x=X,y=Y, color = n), pch=21, size = 4)
First thanks for bringing plotly to R! We love it!
I wonder whether it is related to the fact that color for geom_point with shape=21~25 which have stroke, defines the stroke color; for other shapes that don't have stroke, color defines the fill color. Therefore the complication of translating color from ggplot to plotly.
I have the same problem (plus I need another variable for the size argument). I solved using color instead of fill as sahirmoosvi suggested, but instead of using the stroke argument, I set shape = 16 so a filled circle. The only problem is you can't set the points border color.
Having the same issue - ggplotly with scale_color_gradient works as expected but fails when using scale_fill_gradient. Have left a comment here #606 but this thread here is actually even more applicable to my problem.
Activity
cpsievert commentedon Apr 13, 2018
Thanks, at least for the time being, you can do something like this instead:
slowkow commentedon Apr 16, 2018
Thanks for the suggestion! Unfortunately, it didn't work for me.
Here's what I get:
cpsievert commentedon Apr 16, 2018
You'll need the development version
devtools::install_github('ropensci/plotly')[-]fill does not work[/-][+]ggplot2 point fill doesn't translate correctly[/+]sahirmoosvi commentedon Nov 28, 2019
As an alternative work around I changed the points from fill to color and then increased the stroke enough that the circle gets coloured in. Shouldn't need the development version or the plotly code.
`geom_point(data=someDF, aes(x=X,y=Y, color = n), pch=21, size = 4)
to
`geom_point(data = someDF, aes(x=X,y=Y, color = n), pch=21, size = 2, stroke = 2)
danrlu commentedon Dec 11, 2019
First thanks for bringing plotly to R! We love it!
I wonder whether it is related to the fact that
colorfor geom_point with shape=21~25 which have stroke, defines the stroke color; for other shapes that don't have stroke,colordefines the fill color. Therefore the complication of translating color from ggplot to plotly.See the
filloption for the bottom plot here:https://ggplot2.tidyverse.org/reference/scale_shape.html
I just want to add the observation that
fillwith continuous color scale doesn't seem to work, but with discrete color scale does.R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.2
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.10 plotly_4.9.1 rrBLUP_4.6 ggbeeswarm_0.6.0
[5] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.3 purrr_0.3.3
[9] readr_1.3.1 tidyr_1.0.0 tibble_2.1.3 ggplot2_3.2.1
[13] tidyverse_1.3.0
ShinyFabio commentedon Feb 17, 2022
I have the same problem (plus I need another variable for the size argument). I solved using
colorinstead offillas sahirmoosvi suggested, but instead of using the stroke argument, I setshape = 16so a filled circle. The only problem is you can't set the points border color.mfansler commentedon Feb 3, 2023
Still an issue with
plotly=4.10.1andggplot2=3.4.0.rocanja commentedon Feb 9, 2023
Having the same issue - ggplotly with
scale_color_gradientworks as expected but fails when usingscale_fill_gradient. Have left a comment here #606 but this thread here is actually even more applicable to my problem.