Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. p <- ggplot(Dataset,aes(x=est,ymin=min, ymax=max, y=mean, shape=est))
  2.  
  3. #Added horizontal line at y=0, error bars to points and points with size two
  4. p <- p + geom_hline(yintercept=0, size = 0.2, color = 'red') +
  5. geom_linerange(aes(ymin=min, ymax = mean), color="red") +
  6. geom_linerange(aes(ymin= mean, ymax=max), color="blue") +
  7. geom_point(size=0.2)
  8.  
  9. #Removed legends and with scale_shape_manual point shapes set to 1 and 16
  10. p <- p + guides(size=FALSE,shape=FALSE) + scale_shape_manual(values=c(20, 20, 20, 20))
  11.  
  12. #Changed appearance of plot (black and white theme) and x and y axis labels
  13. p <- p + theme_light() + xlab("Levels") + ylab("confident interval")
  14. #Final adjustments of plot
  15. p <- p + theme(axis.text.x=element_text(size=rel(1.2)),
  16. axis.title.x=element_text(size=rel(1.3)),
  17. axis.text.y=element_text(size=rel(1.2)),
  18. panel.grid.minor=element_blank(),
  19. panel.grid.major=element_blank())
  20.  
  21. #To put levels on y axis you just need to use coord_flip()
  22. p <- p+ coord_flip()
  23. p
  24.  
  25. structure(list(est = c("SOU", "EXP", "AMOU", "SIZ"), min = c(-1.988,
  26. 0.324809225, 0.078056746, 0.009487689), max = c(-1.893, 0.354699871,
  27. 0.08289443, 0.009808696), mean = c(-1.9405, 0.339754548, 0.080475588,
  28. 0.009648193)), .Names = c("est", "min", "max", "mean"), row.names = c(NA,
  29. -4L), class = c("tbl_df", "tbl", "data.frame"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement