3

I have Data similar to this Example (with a larger value range).

Day <- rep(1:5, times=6) 
Fruit <- rep(c("Apple", "Banana", "Blueberry"), times = c(15,10,5)) 
Colour <- rep( c("Yellow","Red", "Green", "Yellow","Blue", "Purple"), each=5)
Values <-rep(c(3,4,5,6,7,4,5,6,7,8,5,6,7,8,9), times=2) 
SorS <- rep("Sweet", times=30) 
sweet <-data.frame(Day, Fruit, Colour, Values, SorS) 
SorS <- rep("Sour", times = 30) 
sour <- data.frame(Day, Fruit, Colour, Values, SorS) 
sour$Values <- sour$Values*10 
sour$Day <- sour$Day*10 
Data <- rbind(sweet, sour)

It would be nice to have single axis for each facet, as present using facet_wrap

ForPlot <-  ggplot(Data, aes(Day, Values), fill=Colour)

    ForPlot+
      geom_point(aes(fill=Colour))+
      ggtitle("Fruity Colours")+
      ylab("Values") + xlab("Day") +
      facet_wrap(SorS~Fruit,  scales= "free", ncol=3)

enter image description here

To simplify the understanding of what is displayed (and compared), it would be great to combine these diagrams(separate axis) with the table like labelling structure of facet_grid:

ForPlot <-  ggplot(Data, aes(Day, Values), fill=Colour)

ForPlot+
  geom_point(aes(fill=Colour))+
  ggtitle("Fruity Colours")+
  ylab("Values") + xlab("Day") +
  facet_rep_grid(SorS~Fruit,  scales= "free", switch="y")

enter image description here

I hope my problem is understandable. Thanks for your help :)

Rui Barradas
  • 70,273
  • 8
  • 34
  • 66
BeccaLi
  • 174
  • 7
  • 1
    Possible duplicate of [How to position strip labels in facet_wrap like in facet_grid](https://stackoverflow.com/questions/63337468/combine-facet-grid-stucture-with-facet-wrap-axis#63337468) and [this](https://stackoverflow.com/questions/44257563/different-x-and-y-axis-scales-in-multifaceted-scatter-ggplot2). – UseR10085 Aug 10 '20 at 09:54

0 Answers0