[R] simple script help

R. Michael Weylandt michael.weylandt at gmail.com
Wed Nov 16 18:02:48 CET 2011


Put pdf() before your loop and dev.off() after -- as it stands now, on
each iteration you re-open the pdf and thereby wipe everything that
was previously on it.

For the axis, look at the axis() command if you want something
detailed or the xaxt, xlab arguments to boxplot if its relatively
simple.

Michael

On Wed, Nov 16, 2011 at 10:54 AM, Nathalie Conte <nac at sanger.ac.uk> wrote:
> HI,
>
>
> I have subsetted a list of exons and put them in a vector exon_list
>> exon_list=levels(test5$V1)
>
> I want to loop using that vector to create a big pdf which will contain all
> my barplots  and doing this I got only the last  element in my exon_list
> plotted rather than all of them, I guess this is a silly newbie mistake,
> could any of you help?
> another point, how to put a numerical scale on X axis in barplot?
>
>> for (i in exon_list){
> + pdf(file="test.pdf", width=30, height=30, pointsize=36)
> + barplot(uniq5[ which(uniq5$V1==i), ]$V5, main=i)
> +
> + dev.off()
> +
> +
> + }
>
> thanks a lot
> Nathalie
>
>
> --
> The Wellcome Trust Sanger Institute is operated by Genome Research Limited,
> a charity registered in England with number 1021457 and a company registered
> in England with number 2742969, whose registered office is 215 Euston Road,
> London, NW1 2BE.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list