精華區beta R_Language 關於我們 聯絡資訊
library(ggplot2) dat1 <- data.frame(categories = c(1,2,3), picachu = c(100,150,120)) dat2 <- data.frame(categories = c(1,2,3), pocketmonster = c(200,250,220)) ggplot(data = dat2,aes(categories,pocketmonster)) + geom_point() + geom_line() + geom_bar(data = dat1 , aes(categories,picachu),stat = "identity") Hi,我想你可以試試看用ggplot,因為它是用圖層式的概念往上疊加 因此就想成先畫出其中一種圖在畫另外一種圖然後疊起來 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.175.242.59 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1479363125.A.263.html
samex4x4: 感謝!!馬上來試作,才剛開始學畫圖,x軸是文字可以嗎? 11/17 15:33
clansoda: scale_x_discrete(label = c("A","B","C")) 11/17 15:55