私は基本グラフィックスでこれを行いますが、他の人が格子またはggplot2で同じかより良いことをすることができると確信しています。私はあなたのデータを使って簡単にそのようなプロットを作成するために必要な主なことは、再フォーマットであり、プロッティングに従うためにはどのようなフォーマットが必要かを再考することだと思います。私はあなたのデータを使って、1)長い形式であった場合、2)色、線種、幅などの基本的な変数が余分な列として使用可能であった場合、このようなデータがあれば、それを減らして線分を描く必要のあるアミノ酸だけを含めることができます。私はあなたのようなデータセットをシミュレートしました。 まずデータセット:あなたはあなたのケースに合わせて、このコードを変更することができるはず
set.seed(1)
# make data.frame just with info for the lines you'll actually draw
# your data was mostly zeros, no need for those lines
position <- sort(sample(1:4563,45,replace = FALSE))
# but the x position needs to be shaved down!
# modulars are the real x positions on the plot:
xpos <- position%%600
# line direction appeared in your example but not in your text
posorneg <- sample(c(-1,1),45,replace = TRUE,prob=c(.05,.95))
# oxidant concentration for line width- just rescale the oxidant concentration
# values you have to fall between say .5 and 3, or whatever is nice and visible
oxconc <- (.5+runif(45))^2
# oxidant type determines line type- you mention 2
# just assign these types to lines types (integers in R)
oxitype <- sample(c(1,2),45,replace = TRUE)
# let's say there's another dimension you want to map color to
# in your example png, but not in your description.
color <- sample(c("green","black","blue"),45,replace=TRUE)
# and finally, which level does each segment need to belong to?
# you have 8 line levels in your example png. This works, might take
# some staring though:
level <- 0
for (i in 0:7){
level[position %in% ((i*600):(i*600+599))] <- 8-i
}
# now stick into data.drame:
AminoData <-data.frame(position = position, xpos = xpos, posorneg = posorneg,
oxconc = oxconc, oxitype = oxitype, level = level, color = color)
OK、あなたはこの単純な何かにあなたのデータを減らすことができます想像してみてください。作図の主なツールは(ベースで)セグメントになります()。これは、ベクトル化するので、ループや装飾性のための必要はありませんされています
# now we draw the base plot:
par(mar=c(3,3,3,3))
plot(NULL, type = "n", axes = FALSE, xlab = "", ylab = "",
ylim = c(0,9), xlim = c(-10,609))
# horizontal segments:
segments(0,1:8,599,1:8,gray(.5))
# some ticks: (also not pretty)
segments(rep(c((0:5)*100,599),8), rep(1:8,each=7)-.05, rep(c((0:5)*100,599),8),
rep(1:8,each=7)+.05, col=gray(.5))
# label endpoints:
text(rep(10,8)+.2,1:8-.2,(7:0)*600,pos=2,cex=.8)
text(rep(589,8)+.2,1:8-.2,(7:0)*600+599,pos=4,cex=.8)
# now the amino line segments, remember segments() is vectorized
segments(AminoData$xpos, AminoData$level, AminoData$xpos,
AminoData$level + .5 * AminoData$posorneg, lty = AminoData$oxitype,
lwd = AminoData$oxconc, col = as.character(AminoData$color))
title("mostly you just need to reshape and prepare\nyour data to do this easily in base")
これは、いくつかの好みのためあまりにも職人であるかもしれないが、それは私が特別なプロットについては行く方法です。
ラインサイズ(線の太さ/幅?)、酸化剤のタイプ、および処理を計算するために使用する酸化剤濃度値を含むダミーデータセットを提供できる場合は、有用かもしれません。治療に基づいた酸化の位置をプロットすることによってあなたが意味することは少しはっきりしません(添付した図の対応する変化する位置は何ですか?上向き対下向き線を指していますか?) – jbaums
"サイズ "。行の高さまたは行の幅は両方とも「行のサイズ」と呼ばれます。 –
@ Jbaums:あなたが正しいです、私は質問を投稿した後、ダミーのデータセットについて考えていました。酸化剤AおよびB濃度(実験で使用)は、10μM、100μMおよび1000μMであった。行のサイズは適切な単語ではありません。以前使用していました。行のサイズは行の高さに置き換えてください。私は、データ表現に干渉する可能性があるため、幅を変更しません(例えば、AA503は100μMで酸化され、504は1000μMで酸化される)。下向きのライン(間接的な酸化)は、もはや酸化剤AおよびBが直接酸化に続くので、もはや大きな懸念事項ではなかった。 –