Peter Kupfer | 22 Nov 15:33 2012

ggplot2 and the legend

Dear all,
i try to plot with ggplot2. Therefor I have an matrix with 3 colums. With cbind I add an additional column
called "col". I need this column "col" because in a later step and want to specify here some plot details
which I will get from another analysis
If I want to plot with this code, I have the problem that the legend is wrong. 
Blue changed to green and green to blue. Furthermore the colors in the plot seem a little bit strange. Can
anybody help me out?
All the best and thanks
Peter

#####THE CODE

p0 <- ggplot(DATA, aes(Freq, Var1))
p1 <- p0+ geom_point(aes(Freq, reorder(Var1, rep(score,cl.count)), colour=col)) 

p2  <- p1 +geom_segment(aes(x = 0, xend = Freq, y = Var1, yend = Var1, colour=col))
p3 <- p2 + facet_grid(.~Var2)
plot(p3)

#### THE DATA #

#class(DATA) = data.frame
#class(DATA$Var1) = class(DATA$Var2) =  factor

#class(DATA$Freq) = numeric
#class(DATA$col) = character

Var1	Var2	Freq	col	
1	208869_s_at	JT	10.6802376685463	blue
2	203394_s_at	JT	10.0160470327077	blue
3	201533_at	JT	9.58401500697783	blue
4	216520_s_at	JT	9.07764840614892	blue
5	210999_s_at	JT	9.00219110130877	green
6	212284_x_at	JT	8.62193952504277	blue
7	203752_s_at	JT	8.69193736253539	green
8	203574_at	JT	8.41492571590263	blue
9	219629_at	JT	8.19111292436667	blue
10	201473_at	JT	8.035082989931	green
11	210592_s_at	JT	8.00639829720742	green
12	200768_s_at	JT	7.88012483915651	green
13	201565_s_at	JT	7.89885432096935	green
14	AFFX-r2-P1-cre-3_at	JT	7.86490927895639	blue
15	202014_at	JT	7.69345791769434	green
16	212671_s_at	JT	-7.43350555284605	green
17	203395_s_at	JT	7.51127977823914	blue
18	208980_s_at	JT	7.52175408445448	blue
19	207783_x_at	JT	7.31954223019292	blue
20	215446_s_at	JT	-6.28236730203077	green
21	203034_s_at	JT	7.24582647671987	blue
22	211943_x_at	JT	7.22247828112639	green
23	203974_at	JT	-6.84217612309489	green
24	201810_s_at	JT	7.0727443704914	green
25	201693_s_at	JT	7.11350154823655	blue
26	213614_x_at	JT	7.07586402329325	green
27	AFFX-CreX-5_at	JT	7.05274590106307	blue
28	201798_s_at	JT	-6.98858491240942	blue
29	212869_x_at	JT	6.97833756793094	green
30	201531_at	JT	6.96660504363297	green
31	201170_s_at	JT	6.90904695259236	green
32	200886_s_at	JT	-6.92645789612039	blue
33	AFFX-r2-P1-cre-5_at	JT	6.85399276205727	blue
34	201429_s_at	JT	6.68557384216737	green
35	212665_at	JT	6.75579868986925	green
36	208695_s_at	JT	6.8087149011011	green
37	211654_x_at	JT	-6.7426888322764	green
38	209927_s_at	JT	-6.74856557366229	green
39	203107_x_at	JT	6.72120597236789	blue
40	211296_x_at	JT	6.60226581063165	green
41	208869_s_at	OA	-3.73983541027906	green
42	203394_s_at	OA	-3.29203821581412	green
43	201533_at	OA	-3.2383756900468	blue
44	216520_s_at	OA	-4.59979375515969	blue
45	210999_s_at	OA	-5.10853597491871	green
46	212284_x_at	OA	-5.84925048581651	blue
47	203752_s_at	OA	-4.54427623838229	blue
48	203574_at	OA	-2.59882534850623	blue
49	219629_at	OA	-4.35550869055387	blue
50	201473_at	OA	-3.15685663855675	blue
51	210592_s_at	OA	-4.52611461089035	blue
52	200768_s_at	OA	-2.76833454650619	blue
53	201565_s_at	OA	-3.80972141262264	green
54	AFFX-r2-P1-cre-3_at	OA	-3.53240421347696	green
55	202014_at	OA	-2.60784960582222	blue
56	212671_s_at	OA	1.68584117381632	green
57	203395_s_at	OA	-2.27910272551108	blue
58	208980_s_at	OA	-3.66266591800146	green
59	207783_x_at	OA	-3.93093352561262	blue
60	215446_s_at	OA	6.26626194024723	green
61	203034_s_at	OA	-3.84606488854982	blue
62	211943_x_at	OA	-3.30831181470312	green
63	203974_at	OA	1.17068337099947	green
64	201810_s_at	OA	-2.07855331860079	green
65	201693_s_at	OA	-2.74740330465003	blue
66	213614_x_at	OA	-3.03851670866666	blue
67	AFFX-CreX-5_at	OA	-3.46221400689819	green
68	201798_s_at	OA	4.03100733638473	green
69	212869_x_at	OA	-3.97300711584927	green
70	201531_at	OA	-2.96907452702537	green
71	201170_s_at	OA	-2.70131412682545	green
72	200886_s_at	OA	2.96401783822817	blue
73	AFFX-r2-P1-cre-5_at	OA	-2.89903293592039	blue
74	201429_s_at	OA	-4.35557947874114	blue
75	212665_at	OA	-2.39194028704917	blue
76	208695_s_at	OA	-3.35547642329559	green
77	211654_x_at	OA	2.68663713811722	green
78	209927_s_at	OA	3.34341605878591	blue
79	203107_x_at	OA	-3.66321419312914	blue
80	211296_x_at	OA	-4.25932160076237	green
81	208869_s_at	RA	-6.52772554526193	green
82	203394_s_at	RA	-6.32419887021955	green
83	201533_at	RA	-5.96832724224416	blue
84	216520_s_at	RA	-4.21160115876773	blue
85	210999_s_at	RA	-3.662138171127	green
86	212284_x_at	RA	-2.60782479125985	blue
87	203752_s_at	RA	-3.90104095781671	green
88	203574_at	RA	-5.47027470876589	blue
89	219629_at	RA	-3.60753898792399	green
90	201473_at	RA	-4.58816673507709	green
91	210592_s_at	RA	-3.27334582039087	blue
92	200768_s_at	RA	-4.80784295112116	blue
93	201565_s_at	RA	-3.8459928330509	blue
94	AFFX-r2-P1-cre-3_at	RA	-4.07489406787897	green
95	202014_at	RA	-4.7832177524091	green
96	212671_s_at	RA	5.40590792815972	green
97	203395_s_at	RA	-4.92107150759781	blue
98	208980_s_at	RA	-3.62962656459378	green
99	207783_x_at	RA	-3.18712183828209	blue
100	215446_s_at	RA	0.0151477360559071	blue
101	203034_s_at	RA	-3.19761157077928	blue
102	211943_x_at	RA	-3.68142990571529	blue
103	203974_at	RA	5.33426547049511	green
104	201810_s_at	RA	-4.69723616790538	blue
105	201693_s_at	RA	-4.10648979370521	green
106	213614_x_at	RA	-3.79728641367864	blue
107	AFFX-CreX-5_at	RA	-3.37703866352978	green
108	201798_s_at	RA	2.78171984514488	green
109	212869_x_at	RA	-2.8266333324756	blue
110	201531_at	RA	-3.7598371247344	green
111	201170_s_at	RA	-3.95754079263605	green
112	200886_s_at	RA	3.72683314668998	blue
113	AFFX-r2-P1-cre-5_at	RA	-3.71979768994025	blue
114	201429_s_at	RA	-2.19145276606072	green
115	212665_at	RA	-4.10438313399814	blue
116	208695_s_at	RA	-3.24790872151558	green
117	211654_x_at	RA	3.81487862974044	blue
118	209927_s_at	RA	3.20267913105723	green
119	203107_x_at	RA	-2.87616341412488	blue
120	211296_x_at	RA	-2.20363261389773	green

	[[alternative HTML version deleted]]

_______________________________________________
Bioconductor mailing list
Bioconductor@...
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


Gmane