如何不在Trelis图形中显示NA值?

时间:2019-04-04 22:49:50

标签: r

如何消除trellis图中的NA值。 我的代码如下

install.packages("ggplot2")

library(ggplot2)

macdata <- read.csv("C:\\Users\\Akshay Nair\\Downloads\\MacqArandaCook.csv", header = T)

library(tidyverse)

macdata$Bathrooms<-factor(macdata$Bathrooms,levels=c(1,2,3), labels=c("1 Bathroom", "2 Bathrooms", "3 Bathrooms"))

macdata$Suburb<-factor(macdata$Suburb, labels=c("Macquarie", "Aranda", "Cook"))

macdata$Bedrooms<-factor(macdata$Bedrooms,levels=c(3,4,5,6), labels=c("3 Bedrooms", "4 Bedrooms", "5 Bedrooms", "6 Bedrooms"))

p <- qplot(Block.Size, Price, data=macdata, shape=Suburb, color=Suburb,
           facets=Bathrooms~Bedrooms, main="Scatterplots of Block Size by Suburb vs Price", xlab="Block size", ylab="Price")

p + theme_bw() 

p + theme(axis.title=element_text(face="bold.italic",
                                  size="12", color="brown"), legend.position="top")

0 个答案:

没有答案