1.执行下列任务:
使用内置的dataset mtcar,使用2,2配置参数mfrow,并使用以下参数生成4个图,并查看如何绘制这些图。
mtcars$mpg vs mtcars$cyl
mtcars$mpg vs mtcars$hp
mtcars$mpg vs mtcars$wt
mtcars$mpg vs mtcars$vs2.执行下列任务:
使用内置的dataset Orange,并为列树生成条形图.
使用下面的条形图。
Name of the chart - Trees count
x-axis - Tree Types
y-axis - count
Ensure that the barplot is red in color.3.执行下列任务:
将上一步中生成的条形图旋转到水平方向,改变轴和将条形图的颜色改为绿色。
4.执行下列任务:
使用内置的数据集、mtcar和列cyl和齿轮创建一个堆叠的条形图。
5.执行下列任务:
为mtcar数据集的前6项创建一个Pie图表。根据数据集的行名(标签)绘制mpg值。
我试过使用这段代码,但也许我无法正确理解这个问题,就像在katacoda环境中一样。我无法向前迈进。代码:
data(mtcars)
par(mfrow=c(2,2))
plot(mtcars$mpg,mtcars$cyl)
plot(mtcars$mpg,mtcars$hp)
plot(mtcars$mpg,mtcars$wt)
plot(mtcars$mpg,mtcars$vs)
data(Orange)
plot(Orange$Tree)
count<-table(Orange$Tree)
barplot(count,main="Trees count",xlab="Tree Types",ylab="count",col="Red")
barplot(count,main="Trees count",xlab="count",ylab="Tree Types",col="Green",horiz="TRUE",las=1)
data(mtcars)
plot(mtcars$cyl,mtcars$gear)
data(mtcars)
pie(table(mtcars$mpg[1:6]),labels=row.names(mtcars)[1:6])发布于 2020-12-13 18:37:11
data(mtcars)
par(mfrow = c(2,2))
plot(mtcars$mpg,mtcars$cyl)
plot(mtcars$mpg,mtcars$hp)
plot(mtcars$mpg,mtcars$wt)
plot(mtcars$mpg,mtcars$vs)data(Orange)
count<-table(Orange$Tree)
barplot(count, main="Trees count", xlab="Tree Types", ylab="count", col=c("red"))barplot(count, main="Trees count", xlab="count", ylab="Tree Types", col=c("green"),
horiz = TRUE)data(mtcars)
counts <- table(mtcars$cyl, mtcars$gear)
barplot(counts, xlab="cyl", ylab="gear")pie(table(mtcars$mpg[1:6]),labels=row.names(mtcars)[1:6])https://stackoverflow.com/questions/65272540
复制相似问题