baptiste
On Fri, Oct 2, 2009 at 9:26 AM, Jone Wy <rinec...@gmail.com> wrote:
> Thank you baptiste, I tried that. But I find some arguments did not
> work at theme_bw(). I used theme_set(theme_bw()). But this may be due
> to that fact that I am a beginner in both R and ggplot2.
>
> Now I am more concernd about the positions of the axis. Any insight
> would be much appreciated.
>> > effectively alter the output to the traditional black and white graph.- Hide quoted text -
>>
>> - Show quoted text -
hgram <- qplot(rating, data = movies, binwidth = 1)
hgram + theme_bw() + scale_y_continuous(expand=c(0,0))
Does this help?
baptiste
I have tuned ggplot2 to have (in my opinion) to be aesthetically
appealing and perceptually well sound - the demands on the top
ecological journals did come into play ;) As Baptiste mentioned, if
you have particular needs, you can create your own theme.
Hadley
No, the bars start from the line y = 0, which is where you'd expect.
It's a really bad idea to put the axes right on the limits of the data
because then they overlap!
> Code:
> temp1<-mo1.tc2.0005$contributions
> mo1.rel.inf<-data.frame(temp1)
> a1<-ggplot(mo1.rel.inf,aes(var,rel.inf),stat="identity")+geom_bar()
> +ylim(0,80)
>> mo1.rel.inf
> var rel.inf
> 1 Complementarity 70.2882460
> 2 H 25.7461915
> 3 Ecosystems 3.5824652
> 4 Origin 0.3830973
Judging from that output, there is something weird going on with your
variables - is var is a factor?
Hadley
On Fri, Oct 2, 2009 at 3:55 PM, Jone Wy <rinec...@gmail.com> wrote:
> yes. the expand=c(0,0) is doing the work. Thanks a lot. I will reconsider
> the thought of eliminating any of the space between axis line and geom(bars)
> after Hadley's comment though.
>
I personally agree with the idea that having the data touch the axes
is a bad idea. However I know some people won't tolerate axes that
don't meet, or extend further than the data (especially when the data
are bound between 0 and 1), or the absence of a thick box frame around
the plot.
A compromise I found was to add horizontal lines (or vertical) with
annotate() at, say, 0 and 1. In your case that would be an horizontal
line at the base of the bars. If not too obtrusive in colour or
thickness, Tufte might not call it junk.