[R] legend title in qplot

RON70 ron_michael70 at yahoo.com
Fri Jul 24 14:26:55 CEST 2009


PLEASE IGNORE MY PREVIOUS MAIL



RON70 wrote:
> 
> Thank you for your reply. Yes I am reading that document and ofcourse
> simultaniously trying to apply in my current problem as well. Yes still I
> am learning.
> 
> Here I have my code :
> 
> library(ggplot2)
> library(plyr)
> dat = rnorm(1000); variable = rep(c("Variable:1", "Variable:2"),
> each=500); coll = rep(c("10", "20"), each=500); dat1 = data.frame(dat,
> variable, coll); dat1
> p = ggplot(dat1) + geom_line(aes(y=dat, x=1:500, colour=coll),
> group=variable) +  facet_grid(variable ~ .); p 
> #p + scale_colour_hue(h = c(0, 90), l=70, c=30)
> 
> Here I have not used scale_colour_hue() function because I fill I have
> very little control over the colors at least for my current problem.
> Therefore I have created a new variable "coll" and put the numbers for
> that variable, which best match my desired color.
> 
> However here my problem is in color pallet, values of "coll" is displayed,
> not values of "variable". But this problem can be solved if I use
> scale_colour_hue(). Can anyone please suggest how to show the values of
> "variable" in pallet correctly?
> 
> 
> baptiste auguie-5 wrote:
>> 
>> ?scale_fill_discrete()
>> 
>> qplot(x,y,data=data.frame(x=1,y=1,f="a"),fill=f) +
>> scale_fill_discrete("test")
>> 
>> baptiste
>> 
>> HTH,
>> 
>> 
>> 2009/7/21 rajesh j <akshay.rajesh at gmail.com>
>> 
>>> Hi,
>>>
>>> I've used the following command in qplot
>>> qplot(a$V1,geom="histogram",binwidth=0.15,fill =
>>> factor(a$V2),ylab="Frequency",xlab="Rate");
>>> but the title in the legend shows up as factor(a$V2)...how can i change
>>> this?
>>>
>>> --
>>> Rajesh.J
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>> 
>> 
>> 
>> -- 
>> 
>> _____________________________
>> 
>> Baptiste Auguié
>> 
>> School of Physics
>> University of Exeter
>> Stocker Road,
>> Exeter, Devon,
>> EX4 4QL, UK
>> 
>> Phone: +44 1392 264187
>> 
>> http://newton.ex.ac.uk/research/emag
>> ______________________________
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/legend-title-in-qplot-tp24582597p24643654.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list