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
We are very happy to have found ggpubr; we find it very useful. I've encountered two apparent bugs, however, both having to do with the label= option. I am very new to GitHub and fairly new to R - I already found that what I had reported earlier as a bug was just that I didn’t have the latest version of ggplot2. But what I report here is seen on multiple Windows and Mac machines, under R3.6.2 with ggpubr as the only package installed, so I am confident about the bugs. Sekhar Ramakrishnan
When I use color= option to display bars of subgroups, the labels are displayed in reverse order within each level of the primary grouping variable:
val8 = c(-10,-20,20,10,-5,-15,15,5)
grp1 = c("A","A","A","A","B","B","B","B")
grp2 = c("X","X","Y","Y","X","X","Y","Y")
df8 = data.frame(val8,grp1,grp2)
ggbarplot(df8,x="grp1",y="val8",color="grp2",add="mean_sd",label=c("AX-15","AY+15","BX-10","BY+10"), position = position_dodge(0.8))
If I use label=TRUE, the labels are correct – the right mean is displayed on each bar:
There is likely a bug in the way “label=” is handled when labels are provided instead of settling for the means. This appears serious since wrong labels on the bars can lead to misinterpretations; I stumbled on the bug while trying to display statistical significances.
The second, less serious, bug is that the labels on the negative bars are not on top but inside at the bottom of the boxes, even with label=TRUE.
Both problems go away if I create a new group grp12 with four levels:
val8 = c(-10,-20,20,10,-5,-15,15,5)
grp12 = c("A-X","A-X","A-Y","A-Y","B-X","B-X","B-Y","B-Y")
df81 = data.frame(val8,grp12)
ggbarplot(df81,x="grp12",y="val8",add="mean_sd",label=c("AXminus15","AYplus15","BXminus10","BYplus10"))
I believe the negative-bar-label-positioning bug has something to do with "position=position_dodge()". If I add that optional argument, which should have no effect when there are no subgroups, the negative bars' labels go to the inside bottoms:
ggbarplot(df81,x="grp12",y="val8",add="mean_sd",label=c("AXminus15","AYplus15","BXminus10","BYplus10"), position = position_dodge(0.8))
I hope this report helps Dr Kassambara fix this problem with labeling bars in a two-group situation. As I mention above, ggpubr is a very valuable resource.
The text was updated successfully, but these errors were encountered:
We are very happy to have found ggpubr; we find it very useful. I've encountered two apparent bugs, however, both having to do with the label= option. I am very new to GitHub and fairly new to R - I already found that what I had reported earlier as a bug was just that I didn’t have the latest version of ggplot2. But what I report here is seen on multiple Windows and Mac machines, under R3.6.2 with ggpubr as the only package installed, so I am confident about the bugs. Sekhar Ramakrishnan
The second, less serious, bug is that the labels on the negative bars are not on top but inside at the bottom of the boxes, even with label=TRUE.
Both problems go away if I create a new group grp12 with four levels:
The text was updated successfully, but these errors were encountered: