R ggplot

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

ggplot2 library

- ggplot2 is a plotting system for R: based on the grammar of graphs, handles many of the details automatically > install.packages("ggplot2") > library("ggplot2")

plotting with ggplot

-the qplot() function can be used to create most common graph types, while hiding ggplot's full power - histogram of one attribute > qplot(data=iris, x=Sepal.Length, main = "Histogram of Sepal.Length") - scatterplot of two attributes qplot(data=iris, x=Sepal.Length, y=Sepal.Width, color= Species) - we can use boxplots for one dimensional data per class qplot(data=iris, y=Sepal.Length, x=Species, geom="boxplot") - Facets show the same plot with different sub-collections of data labeled by levels of a factor > qplot(data=iris, y=Sepal.Length, x=Sepal.Width, facets=~Species) - plots can be stored in objects, and we can add additional layers > P <- qplot(data=iris, y=Sepal.Length, x=Sepal.Width, facets=~Species) > P + stat_smooth(method="lm") - lm is an ordinary least squares trendline, stat_smooth() also shows confidence intervals as grey areas

Saving plots

> ggsave("FacetsWithTrend.jpg") - detects the desired format based on file extension: eps, pdf, tex, jpeg, png, svg, and more > help(ggsave) to learn about other options


संबंधित स्टडी सेट्स

(PrepU) Chapter 13: Blended Competencies, Clinical Reasoning and Processes of Person-Centered Care

View Set

Women's Health/Disorders and Childbearing Health Protection

View Set

APHY 201 Module 12 Fluid and Acid-Base Balance Ivy Tech

View Set

Document Examination Review Questions

View Set

Operations with Complex Numbers assessment

View Set