Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. library(ggplot2)
  2.  
  3. # Generate data
  4. a<-seq(1,101,1)
  5. b<-1.1^(a)+.7*rnorm(length(a))*1.1^(a)
  6.  
  7. df<-data.frame(a,b)
  8.  
  9. ggplot(df, aes(b,a))+
  10. geom_point(shape=21, size=3, color="black", fill="steelblue1")+
  11. labs(title="Exploring X-Semilog",
  12. subtitle="Before transformation",
  13. x="Data (units)",
  14. y="Data (units)")+
  15. theme_bw()
  16. ggsave("before.png", height=5, width=7, dpi=120, type="cairo-png")
  17.  
  18. ggplot(df, aes(b,a))+
  19. geom_point(shape=21, size=3, color="black", fill="steelblue1")+
  20. scale_x_log10(breaks=10^seq(0,4,2),
  21. minor_breaks=as.vector(outer(10^seq(0,4,2), 1:10, "*")))+
  22. labs(title="Exploring X-Semilog",
  23. subtitle="After transformation",
  24. x="Data (units)",
  25. y="Data (units)")+
  26. theme_bw()
  27. ggsave("after.png", height=5, width=7, dpi=120, type="cairo-png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement