>>> library(ggplot2)
>>> qplot(data=diamonds, y=price, x=carat, facets=.~color)
This command plots seven facets, each for every value of colors, in an
unique plot... but what if I want to split it so I have two colors per
plot, for example D-E, F-G, H-I, and J in the last page?
The only solution that I could get (thanks to an old post in this
mailing list) is to split the input data into multiple subset and
repeat the plot for each one of them. This does work, but not very
well, because the last page will contain a fewer number of elements
than the others and therefore will have a different layout (see again
the example for the diamond data, in which the last plot will have
only the J color).
On lattice, there is a parameter called layout that you can pass to a
plotting function to tell it to split output to a number of rows,
columns and pages. As far as I know there is no way to do so with
ggplot.. are you planning on implementing this feature soon?
And in the meantime, do you have any idea on how I can get good
results by splitting the input data and plotting it multiple times,
and then call ggplot in order to generate the last page with the same
layout as the other ones? I thought about plotting blank datasets, but
I don't like this idea very much..
--
Giovanni Dall'Olio, phd student
Department of Biologia Evolutiva at CEXS-UPF (Barcelona, Spain)
My blog on bioinformatics: http://bioinfoblog.it
I don't know if this is the best way for ggplot2 :-p,
and I also don't like this kind of hack because I like the
user-friendly drawing system of ggplot2,
but at least you can remove the extra panel after drawing dummy data
via grid.remove as follows:
d<-rbind(diamonds[1,],diamonds)
levels(d$color)<-c(levels(d$color),"Z")
d[1,]$color<-"Z"
q<-ggplot(subset(d,color%in%c("J","Z")),aes(x=carat,y=price))+facet_grid(.~color)+geom_point()
print(q)
grid.remove("panel-3-5")
grid.remove("axis_h-5-5")
grid.remove("strip_h-1-5")
HTH.
2010/3/17 Giovanni Marco Dall'Olio <dallo...@gmail.com>:
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> To post to this group, send email to ggp...@googlegroups.com
> To unsubscribe from this group, send email to
> ggplot2+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ggplot2
To help me decide where to place this on my priority list, I need to
know two things:
* do you need this only for facet_wrap, or also for facet_grid?
* how many other people would find this useful?
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
> I have also reported this on github, here is the entry:To help me decide where to place this on my priority list, I need to
> -
> http://github.com/hadley/ggplot2/issuesearch?state=open&q=multiple#issue/83
know two things:
* do you need this only for facet_wrap, or also for facet_grid?
* how many other people would find this useful?
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
I find this useful too. For me multi-page facet_wrap is more useful.
xiechao
>
> Hadley
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>
I would find it very usefull for both facet_grid and facet_wrap. Until
now I did it manually in a production script with facet_wrap with 20 to
100 facets. I need to group them in 4 by 4 layouts to keep the plots
readable.
A nice feature would be that the last page, which will have a smaller
number of facets, has the same facet size as the other pages. So it will
have some blank facets.
Best regards,
Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry....@inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
> -----Oorspronkelijk bericht-----
> Van: ggp...@googlegroups.com
> [mailto:ggp...@googlegroups.com] Namens hadley wickham
> Verzonden: woensdag 17 maart 2010 23:06
> Aan: dallo...@gmail.com
> CC: takahashi kohske; ggplot2
> Onderwerp: Re: how to split a plot into multiple pages, or at
> least mimic so
> --
> You received this message because you are subscribed to the
> ggplot2 mailing list.
> To post to this group, send email to ggp...@googlegroups.com
> To unsubscribe from this group, send email to
> ggplot2+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/ggplot2
>
Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in this message
and any annex are purely those of the writer and may not be regarded as stating
an official position of INBO, as long as the message is not confirmed by a duly
signed document.
--
How would you want the layout to work with facet_grid? Would ggplot2
basically layout the entire plot specification and then divide it up
in to pages of specified size? Or would you want to specify the
variable that divided up the pages?
But multipage plots are pretty crap for data exploration - you're much
better off using linked brushing.
That depends. You could print them and lay them out on your desk.
That gives you a lot of resolution.
Kasper
If you can provide evidence that it's possible to reliably distinguish
between those 24 shapes, I'll happily up the limit ;)
And while we're on the topic of laying out faceted plots, (and this
maybe getting head of things a little) is a feature I wish the layout
option had in lattice, namely, a way to create each layout page in its
own window. This would be moral equivalent of laying sheets of paper
on your desk.
Paul
Interface could simply be that number of columns and rows can
simultaneously be specified.
Best regards
Reinhold
It's pretty easy to make your own:
many_shapes <- scale_shape_manual(values = 1:24)
Hadley
On Thu, Mar 18, 2010 at 2:32 PM, Jean-Louis Abitbol
<ggp...@googlegroups.com> wrote:
> I can see your point.
>
> However having many shapes available is useful when you don't have a
> color printer as it helps identifying individual (patients in my case)
> values of scores*time for example. Varying linetype (even more difficult
> to distinguish) and color is not in fact enough in BW.
>
> It is very much readable when you have 10/15 patients and depending on
> the data you can jitter on the x axis.
>
> I use it even when I have 100+ lines (and it may even be more useful in
> that setting) as it also helps identifying profile of patients when you
> don't have color available. In that setting I don't care that I can make
> the correspondance between a line and a given patient. I'll sort it out
> based on the values. So it is important that the shapes are recycled
> automatically as they are in lattice.
>
> Finally I would think it is up to me to decide if I can reliably
> distinguish... I have dozens of examples available but all with
> confidential data. I could think of making a reproducible example but it
> all so much depends on the data that I don't think this would be very
> meaningful.
>
> This is just a humble wish and I think this is not a matter where you
> should limit the users choice unless it implies major coding work . It
> would be more important to forbid pie plots/bar graphs (ink/data ratio!)
> etc... which obviously you have not done.
>
> Anyway thanks again for your work.
>
> Best wishes, JL
>> --
>> You received this message because you are subscribed to the ggplot2
>> mailing list.
>> To post to this group, send email to ggp...@googlegroups.com
>> To unsubscribe from this group, send email to
>> ggplot2+u...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/ggplot2
>>
> Jean-Louis Abitbol, MD
> Chief Medical Officer
> Trophos SA, Parc scientifique de Luminy, Case 931
> Luminy Biotech Entreprises
> 13288 Marseille Cedex 9 France
> Email: jlab...@trophos.com ---- Backup Email: abi...@sent.com
> Cellular: (33) (0)6 24 47 59 34
> Direct Line: (33) (0)4 91 82 82 73-Switchboard: (33) (0)4 91 82 82 82
> Fax: (33) (0)4 91 82 82 89
Ok, it seems like this is of general interest and I'll add it to my to do list.
The interface will probably be something like page.layout = c(rows, cols)
Is there an update to this setting.
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.