使用R语言画出补正后的stackloss数据集中各变量的直方图、箱型图、散点图、密度曲线图、条形图、饼图、小提琴图、克利夫兰点图、金字塔图、横向堆栈条形图、热图、三维散点图、折线图、森林图、气泡图、相关性图、雷达图
时间: 2023-07-10 08:36:24 浏览: 230
抱歉,我作为一个语言模型,无法在这个平台上展示图片。不过,我可以给您提供一些R语言的代码来绘制这些图表。您可以在本地运行这些代码,查看生成的图表。
直方图:
```R
library(ggplot2)
ggplot(stackloss, aes(x=stack.loss)) +
geom_histogram()
```
箱型图:
```R
ggplot(stackloss, aes(x=Air.Flow, y=stack.loss)) +
geom_boxplot()
```
散点图:
```R
ggplot(stackloss, aes(x=Air.Flow, y=stack.loss)) +
geom_point()
```
密度曲线图:
```R
ggplot(stackloss, aes(x=stack.loss)) +
geom_density()
```
条形图:
```R
ggplot(stackloss, aes(x=as.factor(Induced.Draft), y=stack.loss)) +
geom_bar(stat="identity")
```
饼图:
```R
library(plotrix)
pie3D(stackloss$stack.loss, labels=stackloss$Air.Flow)
```
小提琴图:
```R
ggplot(stackloss, aes(x=as.factor(Induced.Draft), y=stack.loss)) +
geom_violin()
```
克利夫兰点图:
```R
library(car)
scatterplot(stack.loss ~ Air.Flow, data=stackloss)
```
金字塔图:
```R
library(plotrix)
pyramid.plot(stackloss$Air.Flow, stackloss$stack.loss, labels=stackloss$Air.Flow)
```
横向堆栈条形图:
```R
library(plotrix)
stackedbarplot(t(as.matrix(stackloss[c(2,3,4)])), beside=FALSE, legendtext=c("Air.Flow", "Water.Temp", "Acid.Conc."), col=c("red", "green", "blue"))
```
热图:
```R
library(gplots)
heatmap.2(as.matrix(stackloss[c(2,3,4)]), scale="row", trace="none", Colv=FALSE, dendrogram="none")
```
三维散点图:
```R
library(scatterplot3d)
scatterplot3d(stackloss$Air.Flow, stackloss$Water.Temp, stackloss$stack.loss)
```
折线图:
```R
ggplot(stackloss, aes(x=as.factor(Air.Flow), y=stack.loss, group=1)) +
geom_line()
```
森林图:
```R
library(randomForest)
rf <- randomForest(stack.loss ~ ., data=stackloss)
varImpPlot(rf)
```
气泡图:
```R
ggplot(stackloss, aes(x=Air.Flow, y=Water.Temp, size=stack.loss)) +
geom_point()
```
相关性图:
```R
library(corrplot)
corrplot(cor(stackloss[c(2,3,4)]), method="circle")
```
雷达图:
```R
library(fmsb)
stackloss_scaled <- stackloss[c(2,3,4)]
stackloss_scaled[] <- lapply(stackloss_scaled, scale)
stackloss_scaled <- as.data.frame(stackloss_scaled)
stackloss_scaled$Induced.Draft <- stackloss$Induced.Draft
radarchart(stackloss_scaled, axistype=1)
```
阅读全文