0
繪製這種類型的基質的我有此矩陣如何作爲R
CL r1 r2 r3 r4 r5 r6
[1,] 25 0 1 0 0 1 0
[2,] 30 5 3 1 1 1 1
[3,] 35 1 0 1 0 0 1
[4,] 40 0 0 0 0 0 0
我想以這種方式繪製它(從Excel示例)
和
我可以用ggplot2
?或與其他包?
繪製這種類型的基質的我有此矩陣如何作爲R
CL r1 r2 r3 r4 r5 r6
[1,] 25 0 1 0 0 1 0
[2,] 30 5 3 1 1 1 1
[3,] 35 1 0 1 0 0 1
[4,] 40 0 0 0 0 0 0
我想以這種方式繪製它(從Excel示例)
和
我可以用ggplot2
?或與其他包?
爲了您第二情節:
library(reshape2)
library(ggplot2)
df_series<-as.data.frame(matrix_series)
colnames(df_series)<-c("CL", "Series1","Series2","Series3","Series4","Series5", "Series6")
df_series.tall<-melt(df_series, id.vars="CL")
ggplot(df_series.tall, aes(x=CL,y=value, color=variable))+geom_smooth()
對於1號地塊:
ggplot(df_series.tall, aes(x=variable,y=value, fill=factor(CL)))+geom_bar(stat="identity", position="dodge")
那你試試這麼遠嗎? –