Try making window
a factor:
s <- qplot(numVars, olPcnt, data=overlap,
colour=tools,
size=as.factor(window), shape=shape)
문제
I want to draw a plot, where I can decide what the sizes of the plots are in the legend section. So far, this is what I have for the code:
library(ggplots2)
overlap <- read.delim("/R_plots/num_ins_vs_overlap.txt", sep="\t", row.names=1, header=TRUE)
tools <- overlap$tools
window <- overlap$window
numVars <- overlap$number_of_variants
olPcnt <- overlap$pcnt_overlap
shape <- overlap$shape
s <- qplot(numVars, olPcnt, data=overlap, colour=tools, size=window, shape=shape)
s + scale_shape(solid=FALSE) + labs(title="Number of Variants Detected vs. % Overlap", x="Number of Variants Detected", y="% Overlap")
The data itself, looks like shown here:
tools window number_of_variants pcnt_overlap shape
1 scalpel 5 184458 38.32 circle
2 pindel 5 320770 32.42 circle
3 samtools 5 313147 34.16 circle
4 UnifiedGenotyper 5 234746 36.98 circle
5 scalpel 20 184458 39.33 circle
6 pindel 20 320770 33.10 circle
7 samtools 20 313147 35.18 circle
8 UnifiedGenotyper 20 234746 38.38 circle
9 scalpel 50 184458 39.83 circle
10 pindel 50 320770 32.92 circle
11 samtools 50 313147 35.91 circle
12 UnifiedGenotyper 50 234746 39.16 circle
13 scalpel 100 184458 40.34 circle
14 pindel 100 320770 32.74 circle
15 samtools 100 313147 37.49 circle
16 UnifiedGenotyper 100 234746 48.66 circle
The window field has 4 different values: (5, 20, 50 and 100) and I would like these to be the sizes of the plots...and it seems like I got that part right, based on what I see on the plots. The trouble is on the legend, I see sizes of (25, 50, 75 and 100. Is there a way for me to tell the script not to change the sizes this way on the legend, and show the actual sizes of the plots instead?
Thanks in advance,
Young
해결책
Try making window
a factor:
s <- qplot(numVars, olPcnt, data=overlap,
colour=tools,
size=as.factor(window), shape=shape)