0

everyone, I want to produce a plot like the below.I can come close, but can not add a vertical line as y axis through zero point. enter image description here

Here is my data and my code:

    Variables   MeanDecreaseAccuaracy     MeanDecreaseGini
    band1             33.991                142.946
    band2             32.729                165.892
    band3             32.254                169.372
    band4             36.721                209.631
    band5             36.525                141.047
    band6             40.496                232.536
    band7             39.886                226.782
    band8             4.315                 5.334

My code :

p <- ggplot(data = df1, aes(x = df1$MeanDecreaseAccuaracy, y = reorder(factor(df1$Variables),df1$MeanDecreaseAccuaracy)))

p + geom_segment(aes(yend = df1$Variables,xend = 0)) + 
geom_point() + 
theme_minimal() + 
scale_x_continuous(breaks = c(0,10,20,30,40,50)) + 
labs(x = "Mean Decrease in Accuracy",y = "Prdictors variable") + 
theme(axis.line = element_line(colour = "black"),
    axis.text.x = element_text(colour = "black"),
    axis.text.y = element_text(colour = "black"),
    axis.ticks.x = element_line(size = 0.2,colour = "black"),
    axis.ticks.y = element_line(size = 0.2,colour = "black"),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank())

Note: df1 is my data. And here is my plot. enter image description here

joran
  • 169,992
  • 32
  • 429
  • 468
JimmyGao
  • 55
  • 1
  • 9
  • Thanks for your help.This works well. – JimmyGao Dec 18 '15 at 11:27
  • @beetroot, you ought to post as answer and Jimmy ought to accept it. Basic hygene. – Mike Wise Jan 07 '16 at 18:47
  • Sorry did not mean to offend. Just looking for questions to answer. All these answered but unaccepted ones seem like such a waste of points and make open questions much harder to find. Been here like 2 or 3 times now. Makes it hard to help other people. – Mike Wise Jan 08 '16 at 08:07
  • Good. I understand your points, they are valid, but not decisive. Plenty of questions that are marked as duplicates are worth way more, both in the way they were formulated, and the way they are answered, than the original. Also I don't see how your points address the points I made. – Mike Wise Jan 08 '16 at 10:36

0 Answers0