Syntax to split facet plots into 2 rows

30 views
Skip to first unread message

Neotropical bat risk assessments

unread,
Mar 24, 2009, 1:40:48 PM3/24/09
to ggp...@googlegroups.com
Hi all,

I have virtually what I need for publication, but I need to se the plots so I have two rows.  The top would be the 2006 and bottom 2007 to show readers the comparison.

All I have managed is to get this with a single row and by setting the PNG size was able to get the labels correctly displayed.

Now if I can get the plot to stack or two rows It will fit on page better.

Also still have not been able to solve the Centering issue of the Y axis label that seems to be forced to the bottom.
[]


Cheers from the jungles of Belize,

Bruce

James Howison

unread,
Mar 24, 2009, 3:16:41 PM3/24/09
to ggplot2
Perhaps try creating a year variable, then using it as the Y part of
faceting. eg + facet_grid(year ~ day)

To get the labels to the right font size, use
theme_set(theme_grey(base_size = 7)) (or whatever size), best way to
do it for publication, I find is as a PDF, made to exactly the right
size, so that you get exactly the right sized font. You can also turn
the labels to a different angle somehow.

Not sure what you mean by centering on the Y axis ...

--J

On 24 Mar 2009, at 1:40 PM, Neotropical bat risk assessments wrote:

> Hi all,
>
> I have virtually what I need for publication, but I need to se the
> plots so I have two rows. The top would be the 2006 and bottom 2007
> to show readers the comparison.
>
> All I have managed is to get this with a single row and by setting
> the PNG size was able to get the labels correctly displayed.
>
> Now if I can get the plot to stack or two rows It will fit on page
> better.
>
> Also still have not been able to solve the Centering issue of the Y
> axis label that seems to be forced to the bottom.
> < La Serafina all_plot.png>

Neotropical bat risk assessments

unread,
Mar 24, 2009, 3:21:45 PM3/24/09
to ggp...@googlegroups.com
Hi all,

Sorry meant to send the lines of code for the plot and missed that.

Here is is:

.....
ggplot(ElTab, aes(Date, elapsed, colour = Location)) +
  geom_jitter() +
  facet_wrap(~ Species)
#adding the ylab line works.
breaks <- (1:24) * 3600
labels <- paste(c(19:23, 0:18), "00", sep = ":")
f=png(file="El Taburete all_plot.png", width = 1000, height = 600,
    units = "px", pointsize = 8, bg = "white",
    res = NA, restoreConsole = TRUE)
 
ggplot(ElTab, aes(Species, elapsed,)) +
  geom_point() +
  facet_grid(. ~ Date) +
  scale_y_continuous(breaks = breaks, labels = labels) + ylab("Time")
dev.off()

 




I have virtually what I need for publication, but I need to se the plots so I have two rows. The top would be the 2006 and bottom 2007 to show readers the comparison.

All I have managed is to get this with a single row and by setting the PNG size was able to get the labels correctly displayed.

Now if I can get the plot to stack or two rows It will fit on page better.

Also still have not been able to solve the Centering issue of the Y axis label that seems to be forced to the bottom.
[]

baptiste auguie

unread,
Mar 24, 2009, 4:06:19 PM3/24/09
to Neotropical bat risk assessments, ggp...@googlegroups.com
for the y-label, see

http://groups.google.com/group/ggplot2/browse_thread/thread/5f474932b0ab8877/969a5d2d4295abd6?lnk=gst&q=odd#969a5d2d4295abd6

and the workaround i suggested you,

http://groups.google.com/group/ggplot2/browse_thread/thread/e5f1adad233e7462/94f523bfdc9a2ca9?lnk=gst&q=ggplotpp#94f523bfdc9a2ca9

baptiste
> Cheers from the jungles of Belize,
>
> Bruce
>
> >
>



--

_____________________________

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
______________________________

baptiste auguie

unread,
Mar 24, 2009, 5:51:24 PM3/24/09
to Neotropical bat risk assessments, ggp...@googlegroups.com
On Tue, Mar 24, 2009 at 9:41 PM, Neotropical bat risk assessments
<neotropi...@gmail.com> wrote:
> No package by the name you link to.
>

I don't know what you mean, it is definitely there.
http://r-forge.r-project.org/R/?group_id=375

alternatively you could just source the theme_bw() i posted or the one
in the dev version of ggplot2.

baptiste

> I tried this last time and it did not work
> Tnx anyway.
Reply all
Reply to author
Forward
0 new messages