Yes, unfortunately I haven't worked out all the interactions between
the coordinate systems and facetting with free scales. It's not
immediately obvious what should happen here - should coord_flip also
flip the facetting variables?
Hadley
If possible I think it should be consistent with the idea that
coord_flip() is the last thing you add. ie build the plot with
regular orientation, then apply coord_flip(). So the 'x' and 'y' axes
should refer to the situation without coord_flip(). That's what
happens with, for example, labeling the axes at the moment (eg
scale_y_continuous(name="Y axis")+coord_flip() puts that label on the
horizontal axis).
For that reason I think that scales="free_y" should do the same, after
coord_flip() that means that the horizontal axis scale is free. With
scales="free" it's not going to matter. Or am I missing something?
Cheers,
James
The problem is that coord_flip() isn't necessarily the last thing you
add. i.e. you could do:
+ coord_flip()
+ facet_grid()
which should have the same effect as the opposite order (or at least I
think it should, based on the current principle that only the ordering
of the layers makes any difference to the final plot)
> For that reason I think that scales="free_y" should do the same, after
> coord_flip() that means that the horizontal axis scale is free. With
> scales="free" it's not going to matter. Or am I missing something?
I think that makes sense, but it's not obvious to me (yet) how to code
that, and how it should work in general for all coordinate systems.
Regards,
Hadley
>
>> If possible I think it should be consistent with the idea that
>> coord_flip() is the last thing you add. ie build the plot with
>> regular orientation, then apply coord_flip(). So the 'x' and 'y'
>> axes
>> should refer to the situation without coord_flip(). That's what
>> happens with, for example, labeling the axes at the moment (eg
>> scale_y_continuous(name="Y axis")+coord_flip() puts that label on the
>> horizontal axis).
>
> The problem is that coord_flip() isn't necessarily the last thing you
> add. i.e. you could do:
>
> + coord_flip()
> + facet_grid()
>
> which should have the same effect as the opposite order (or at least I
> think it should, based on the current principle that only the ordering
> of the layers makes any difference to the final plot)
Ah, that is an issue then. So in that case things that refer to x and
y should be in reference to the 'vertical' plot before the
coord_flip() and the horizontal plot in layers after the
coord_flip(). That's going to confuse people, but you could give a
strong recommendation that it is either used as the first or last
layer ...
>> For that reason I think that scales="free_y" should do the same,
>> after
>> coord_flip() that means that the horizontal axis scale is free. With
>> scales="free" it's not going to matter. Or am I missing something?
>
> I think that makes sense, but it's not obvious to me (yet) how to code
> that, and how it should work in general for all coordinate systems.
Ah well, it certainly ain't obvious to me! Not sure if it has a
logical meaning for coord_polar()?
--J
I have spoke with Hadley about this, and I'd welcome assistance and
suggestions directly to me (rob at aetiologic dot ca ) that I could
include in the template. What are the essential elements in attempting
to answer a user query?
If we can find two or three other folks who would work with me to build
that template (or have other similar ideas!), then maybe we can reduce
the demand on Hadley and improve the value of responses. I cannot but
imagine that traffic on this group is going to grow quickly as word of
ggplot gets out, so setting up a standard format may be essential to
managing future inquiry demands.
Rob James
Well all you really need to do is to check that your version matches
the version on http://cran.r-project.org/web/packages/ggplot2/.
> Copy in the output from R that you see (including the Version of
> ggplot that the line above prints out)
>
> ((Ok, where it gets a little tricky in email is in showing the plot
> and what's wrong with it. Ideally one would paste a link to the
> figure with the ability to highlight/circle parts. Does anyone know
> of a pastie style website that would allow something so cool?))
http://www.jingproject.com/ is quite neat
> We should also refer people to ESR's "How to ask questions the smart
> way" a lot, especially the bits about *followup* and complete, minimal
>
> http://www.catb.org/~esr/faqs/smart-questions.html
>
> Andy Seaborne has a nice definition of complete, minimal:
>
> Complete => standalone code than can be run
> Minimal => only contains code or data relevant to the question.
Oh, I like that!
> Replies should include lots of pointers to the documentation on the
> ggplot2 website and the book, but also mostly executable code :) We
> could nominate techniques etc for adding to the documentation of
> particular elements?
Definitely!
Hadley
>
>> ==Minimal Code:
>>
>> Copy and pastable ggplot2 commands (excluding library(ggplot2) but
>> including loading any other needed libraries. Knowing what version
>> people are using is crucial, the line below does it, but someone
>> better at R can probably make that neater, maybe ggplot2 could have a
>> function to show its version?
>>
>> as.data.frame(installed.packages())["ggplot2",]$Version
>> qplot(data=testdata, ...
>
> Well all you really need to do is to check that your version matches
> the version on http://cran.r-project.org/web/packages/ggplot2/.
Yeah, but telling people to do that is one thing, making it easy for
us to see what version they are using, just by copying over the
output, is another :)
>> Copy in the output from R that you see (including the Version of
>> ggplot that the line above prints out)
>>
>> ((Ok, where it gets a little tricky in email is in showing the plot
>> and what's wrong with it. Ideally one would paste a link to the
>> figure with the ability to highlight/circle parts. Does anyone know
>> of a pastie style website that would allow something so cool?))
>
> http://www.jingproject.com/ is quite neat
Indeed, must check that out more :) Thx.
--J