Feldspar
[This article was first published on ggtern: ternary diagrams in R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Sean Mulcahy made an example of plotting Elkin and Grove's 1990 Feldspar Data. Here is an equivalent plot in three variables:
- Phase (Shape)
- Temperature (Color Gradient), and;
- Pressure (Size)
Code to Produce the Above…
# Load data data(Feldspar) # Sort it by decreasing pressure # (so small grobs sit on top of large grobs Feldspar <- Feldspar[with(Feldspar, order(-P.Gpa)), ] # Build and Render the Plot ggtern(data = Feldspar, aes(x = An, y = Ab, z = Or)) + #the layer geom_point(aes(fill = T.C, size = P.Gpa, shape = Feldspar)) + #scales scale_shape_manual(values = c(21, 24)) + scale_size_continuous(range = c(2.5, 7.5)) + scale_fill_gradient(low = "green", high = "red") + #theme tweaks theme_tern_bw() + theme(legend.position = c(0, 1), legend.justification = c(0, 1), legend.box.just = "left") + #tweak guides guides(shape= guide_legend(order =1, override.aes=list(size=5)), size = guide_legend(order =2), fill = guide_colourbar(order=3)) + #labels and title labs(size = "Pressure/GPa", fill = "Temperature/C") + ggtitle("Feldspar - Elkins and Grove 1990")
The post Feldspar appeared first on ggtern: ternary diagrams in R.
To leave a comment for the author, please follow the link and comment on their blog: ggtern: ternary diagrams in R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.