Skip to content

main title x title and y title with ggplot2

7 messages · guillaume chaumet, ONKELINX, Thierry, Ingo Michaelis +1 more

#
Guillaume,

Have a look at the ggplot book on p. 29
(http://had.co.nz/ggplot2/book.pdf). 

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens guillaume chaumet
Verzonden: woensdag 5 maart 2008 8:51
Aan: r-help op r-project.org
Onderwerp: [R] main title x title and y title with ggplot2

Hi R people,
I'm a R newbie and I'm trying to put main title, x title and y title in
my
graph with no success.
Any idea?
I'm sorry for this newbie question..

Guillaume


______________________________________________
R-help op 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.
#
Guillaume,

You'll have to add the appropriate scales. 

ggplot(data, aes(x,y,fill)) + geom_point() + scale_x_continuous("your
xlabel") + scale_y_continuous("your ylabel")

I suppose you can add a main title in a similar way, but I haven't found
that yet. But I shure that Hadley will answer this.

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens guillaume chaumet
Verzonden: woensdag 5 maart 2008 9:45
Aan: r-help op r-project.org
Onderwerp: Re: [R] main title x title and y title with ggplot2

Thierry
First thank you for the celerity of your response.
Second I use ggplot2 like this :
Where did you your xlab and ylab when using ggplot2 like that?

Guillaume

2008/3/5, ONKELINX, Thierry <Thierry.ONKELINX op inbo.be>:
------------------------------------------------------------------------
of
[mailto:r-help-bounces op r-project.org]
in
______________________________________________
R-help op 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.
#
ONKELINX, Thierry <Thierry.ONKELINX <at> inbo.be> writes:
Guillaume,

I had the same problem and found a solution in some forums. Try this:

p<-ggplot(data, aes(x,y,fill)) + geom_point() + scale_x_continuous("your
xlabel") + scale_y_continuous("your ylabel")

p$title<-"your title"

print(p)

Ingo.
#
The new (more ggplot-like way) is to do:

ggplot(data, aes(x,y,fill)) + ... + opts(title = "my title")

Hadley

--
http://had.co.nz/