2017-08-24 4 views
-1

私はggplot2を使って、同じウィンドウ(同じ12インチ)に同じx軸を持つ複数のグラフをプロットしようとしています。すべてのプロットに固定のy軸を使用する代わりに、そのプロットに適したy軸の範囲を使用したいと考えています。どのようにそれを達成するための任意の提案?Rで複数のプロットを一度にプロットするときにy軸の範囲を変更する方法は?

現在のコード

tube_no <- c(1,2,1,2,1,2,1,2) 
concentration <- c(1000,500,2,3,45,55,100,90) 
dye <- c("blue","blue","red","red","white","white","green","green") 
dat <- data.frame(tube_no,concentration,dye) 


library(ggplot2) 
ggplot(data = dat, aes(x = tube_no, y = concentration)) + geom_point() + facet_wrap(~dye) 
+1

またはこの:[ggplot2、facet_grid、無料のスケール?](https://stackoverflow.com/questions/3685285/ggplot2-facet-grid-free-scales) – Masoud

+1

か:[ ggplot2の各ファセットの軸の制限を、scales = "free"を使用しないで設定する(https://stackoverflow.com/questions/39229455/setting-different-axis-limits-for-each-facet-in-ggplot2-not-スケールを使用しない) – Masoud

答えて

1

あなたはfacet_wrapにスケール= "自由" 引数を使用することができます。

ggplot(data = dat, aes(x = tube_no, y = concentration)) + geom_point() + 
     facet_wrap(~dye, scales="free") 

enter image description here

関連する問題