1

I want to plot a dotplot grouped as non colored figure but filled as the coloured one. To generate coloured I used:

Sample dataset:

data <- data.frame(estado1 = c('APLV','APLV','APLV','APLV','APLV','NO APLV','APLV','NO APLV','NO APLV','APLV','NO APLV','APLV','APLV','APLV','APLV','APLV','APLV','APLV','NO APLV','APLV'), combined_ige = c(3.6,2.84,1.2,14.33,0,0,0,0,0.07,2,0,0.3,0.11,0,0,1.31,0,0,0,0.19), sxtypes = c('skin_resp','skin','skin','skin_dig','dig','dig_resp','skin_dig','dig','dig','skin_resp','skin_dig_resp','dig','dig','dig_resp','skin_dig_resp','skin','dig','skin_dig_resp','resp','skin_dig'))

code

ggplot(data, aes(x=estado1, y=combined_ige, fill= sxtypes)) + 
  geom_dotplot(binaxis='y', stackdir='center',
               stackratio=1.5, dotsize=1.2, alpha=0.6) +
  geom_hline(yintercept = (0.35), linetype="dashed") +
  geom_hline(yintercept = (0.77), linetype="dashed", col="red") +
  xlab("Status group") +
  ggtitle("IgE específicas combinadas") +
  scale_y_log10(labels = function(y) format(y, scientific = F))

When I use "fill = sxtypes" in order to colour dots, them group in layers overlapping each other. I want them to stay in the same positions as in the not coloured figure at the time they colour as in the second figure.

Figure 1

Figure 2

Community
  • 1
  • 1
panchtox
  • 634
  • 7
  • 16
  • 2
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. So what exactly is your question here? What did you try and what didn't work? – MrFlick Mar 27 '20 at 23:40
  • I don't think I understand your question.what modification to the plot are you looking for. – Jayamary Divya Ravichandar Mar 28 '20 at 02:24
  • @JayamaryDivyaRavichandar, I've edited the post in order to clarify my question: "When I use "fill = sxtypes" in order to colour dots, them group in layers overlapping each other. I want them to stay in the same positions as in the not coloured figure at the time they colour as in the second figure." – panchtox Mar 28 '20 at 12:23
  • @MrFlick I've added a sample code and some text in order to clarify my question – panchtox Mar 28 '20 at 12:33
  • What was the code uses to make the version without the colors? It appears that in addition to coloring you may have changed the code that modified point size distribution – Jayamary Divya Ravichandar Mar 28 '20 at 16:14
  • No @JayamaryDivyaRavichandar, the only differences are the "fill= sxtypes" inside de aes() function, and the alpha inside geom_dotplot which codes for transparency. – panchtox Mar 28 '20 at 16:52
  • Could you post the code that made the not colored version as well? It appears in addition to modifying color, point size and probably jitter width has been modified to – Jayamary Divya Ravichandar Mar 28 '20 at 17:44
  • Hello @panchtox, could you provide a sample dataset in this way: `dataset <- data.frame(estado_1 = c("APLV",...), combined_ige = c(3.6,...), sxtypes = c("skin_resp",...))` so we can apply your previous code and test what you want? That way we can help you. – Manu Mar 30 '20 at 01:35
  • @Manu added that way – panchtox Mar 30 '20 at 02:06

0 Answers0