2011-10-13 6 views
28

私はを使用して時間経過のデータ(画面上のさまざまなオブジェクトに対する固定比率)をプロットし、リボンを使用してSEを表示したいが、リボン自体に上端と下端があり、グラフの読み取りが少し難しくなります。私はそれらのエッジラインを取り除く方法を理解することができませんでした。ここに私のプロットコードです:ggplot:リボンの端で線を外す

ggplot(gaze, aes(Time, Fix, color=Object, fill=Object)) + 
    stat_summary(fun.y="mean", geom="line", size=2) + 
    stat_summary(fun.data="mean_se", geom="ribbon", alpha=.3) 

何か提案がありますか?

ここには最小の実例があります。私はに私のデータを圧縮しました:

Time Object   y  lower  upper 
1 1000  C 0.12453389 0.04510504 0.2039627 
2 1000  T 0.58826856 0.37615078 0.8003864 
3 1000  U 0.09437160 0.03278069 0.1559625 
4 1100  C 0.12140127 0.03943988 0.2033627 
5 1100  T 0.64560823 0.44898727 0.8422292 
6 1100  U 0.06725172 0.01584248 0.1186610 

d <- structure(list(Time = c(1000L, 1000L, 1000L, 1100L, 1100L, 1100L), Object = structure(c(1L, 2L, 3L, 1L, 2L, 3L), .Label = c("C", 
"T", "U"), class = "factor"), y = c(0.12453389, 0.58826856, 0.0943716, 
0.12140127, 0.64560823, 0.06725172), lower = c(0.04510504, 0.37615078, 
0.03278069, 0.03943988, 0.44898727, 0.01584248), upper = c(0.2039627, 
0.8003864, 0.1559625, 0.2033627, 0.8422292, 0.118661)), .Names = c("Time", 
"Object", "y", "lower", "upper"), class = "data.frame", row.names = c("1", 
"2", "3", "4", "5", "6")) 

とここに新しいプロットコードです:あなたが行くここ

ggplot(d, aes(Time, y, color=Object, fill=Object)) + 
    geom_line(size=2) + 
    geom_ribbon(aes(ymin=lower, ymax=upper), alpha=.3, colour=NA) 
+0

あなたは最小限の作業例を構築するのと同じようにように、それをNAを与えます。つまり、グラフコマンドを実行するための簡単なデータを追加する必要があります。 – csgillespie

+0

ありがとう、それは助けたようです。 –

答えて

36

ggplot(d, aes(Time, y, fill=Object)) + 
    geom_line(size=2, aes(colour = Object)) + 
    geom_ribbon(aes(ymin=lower, ymax=upper), alpha=.3) 
2

:あなたはcolour引数を使用して境界線を削除することができ

ggplot(d, aes(Time, y, color=Object, fill=Object)) + 
    geom_line(size=2) + 
    geom_ribbon(aes(ymin=lower, ymax=upper), alpha=.3) 
15

geom_ribbonを理解するlinetype審美的です。ここ

ggplot(d, aes(Time, y, color=Object, fill=Object)) + 
    geom_line(size=2) + 
    geom_ribbon(aes(ymin=lower, ymax=upper, linetype=NA), alpha=.3) 

詳細情報:http://docs.ggplot2.org/current/geom_ribbon.html

+0

'linetype = NA'は私のためには動作しませんが、' linetype = 0'や 'linetype = 'blank''が動作します。 http://ggplot2.tidyverse.org/reference/aes_linetype_size_shape.html – fber

関連する問題