0

Hi I'm trying to make a dotplot but have got pretty big differences between my groups so am trying to create a graph with breaks in the axis to display this:

Condition Value
A 0
A 0
A 0
B 650
B 1600
B 900
C 85000
C 15000
C 60000

The script I've used is:

p<-ggplot(d, aes(x=Condition, y=Value, fill=Condition))+   geom_dotplot(binaxis = 'y', stackdir = "center", position=position_dodge(), dotsize = .6)+   ylim(0,90000) p2<-p+scale_y_break(c(10,600), scales=50)+scale_y_break(c(2000,12000),scales = 150)

This puts the breaks where I want them to be but the problem I'm having is how it changes the size of the dots:

enter image description here

I understand that I can change the size of the dots using binwidth and dotsize but changing it so the dots of group A are a reasonable size makes those in group C so small they can't even be seen. Is there any way I can change it so they are just all the same size. Also is there a way I can change the size of the first section of the graph (0-10 on the y axis)?

Mar77
  • 1

1 Answers1

0

Perhaps a pseudo log scale:

data.frame(
  stringsAsFactors = FALSE,
         Condition = c("A", "A", "A", "B", "B", "B", "C", "C", "C"),
             Value = c(0L, 0L, 0L, 650L, 1600L, 900L, 85000L, 15000L, 60000L)
) %>%
  
  ggplot(aes(x=Condition, y=Value, fill=Condition))+   
  geom_dotplot(binaxis = 'y', stackdir = "center", position=position_dodge(), dotsize = 1)+   
  scale_y_continuous(trans = scales::pseudo_log_trans(sigma = 0.1),
                     breaks = c(0, 10^c(0:6)),
                     labels = scales::label_number_si(accuracy = 1))

enter image description here

Jon Spring
  • 55,165
  • 4
  • 35
  • 53