[R] R PNG graph width limitation

Yihui Xie xieyihui at gmail.com
Wed Sep 23 06:28:18 CEST 2009


I see. What you meant by "human readable" is to separate the lines and
texts in the graph, and that's why you need a so wide graph. Well, I
guess, as Henrik told you, the graph was indeed generated there, but
your viewer was not able to show it.

I also found Adobe Reader cannot display a document that's wider than
200 inches (my OS: Windows XP). Maybe you should try to print it on a
huge piece of paper?

Again, I cannot understand how can a 450-inches-long graph be "human
readable"; I mean, how can your eyes read 5981 subjects in a single
graph... It sounds like counting the stars in the sky. If you insist
on reading the result of your clustering of 5981 cases, I'd suggest
looking at smaller pieces of results at one time (i.e. sub-clusters).

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA



On Tue, Sep 22, 2009 at 1:43 PM, Zhengping Huang <zhengping at gmail.com> wrote:
> Dear Mr. Xie,
>
> Please find the attached ZIP file, which when unzip will expand to four
> files:
>
> (1) mean_ratio.090921_08.txt.noheader
> input data file;
>
> (2) mean_ratio.090921_08.txt.noheader.ward.width_200.pdf
>
> By these R command:
>
>>
>> data<-read.table(file="mean_ratio.090921_08.txt.noheader",row.names=1,sep="\t",quote="\"")
>> hc<-hclust(dist(data),"ward")
>>
>> pdf(file="mean_ratio.090921_08.txt.noheader.ward.pdf",bg="white",pointsize=8,width=200,height=16)
>> plot(hc,hang=-1)
>> dev.off()
>
> (3) mean_ratio.090921_08.txt.noheader.ward.width_100.pdf
>
> By these R command (only difference from (2) is width):
>
>>
>> data<-read.table(file="mean_ratio.090921_08.txt.noheader",row.names=1,sep="\t",quote="\"")
>> hc<-hclust(dist(data),"ward")
>>
>> pdf(file="mean_ratio.090921_08.txt.noheader.ward.pdf",bg="white",pointsize=8,width=100,height=16)
>> plot(hc,hang=-1)
>> dev.off()
>
> (4) mean_ratio.090921_08.txt.noheader.ward.width_200.yihan.pdf
>
> By these R command (suggested by you):
>
>>
>> data<-read.table(file="mean_ratio.090921_08.txt.noheader",row.names=1,sep="\t",quote="\"")
>> hc<-hclust(dist(data),"ward")
>>
>> pdf(file="mean_ratio.090921_08.txt.noheader.ward.pdf",bg="white",pointsize=8,width=200,height=16)
>> par(mar = rep(0, 4))
>> plot(rnorm(10000), pch = 19)
>> dev.off()
>
> Obviously the graph generated by your suggested R codes is not what I want.
> From graph in (2) you can see even with width 200 the graph is still not
> readable in PDF.  I tried to go beyond 200 (210) and it did not work.
>
> You could try to cluster and generate dendrogram on your machine.  I just
> need a human readable dendrogram.
>
> Many thanks!
>
> Zhengping
>
>
>
> On Tue, Sep 22, 2009 at 10:56 AM, Yihui Xie <xieyihui at gmail.com> wrote:
>>
>> Well, if you don't care about its width, I'd suggest you use the pdf()
>> device instead, e.g.
>>
>> # 200 inches!
>> pdf("hugeplot.pdf", width = 200, height = 200)
>> par(mar = rep(0, 4))
>> plot(rnorm(10000), pch = 19)
>> dev.off()
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie <xieyihui at gmail.com>
>> Phone: 515-294-6609 Web: http://yihui.name
>> Department of Statistics, Iowa State University
>> 3211 Snedecor Hall, Ames, IA
>>
>>
>>
>> 2009/9/22 Zhengping Huang <zhengping at gmail.com>:
>> > Thanks a lot Yihui for your kindness and help.  Yes I do need that
>> > graph.  I do not care about resolution as long as it's human readable.
>> > Please suggest how I can make that work.
>> >
>> > Thanks again,
>> >
>> > Zhengping
>> >
>> >
>> > On Tue, Sep 22, 2009 at 10:06 AM, Yihui Xie <xieyihui at gmail.com> wrote:
>> >>
>> >> Given the DPI=72, do you really need a graph that's wider than 450
>> >> inches? Or can you really read a picture that is so wide?
>> >>
>> >> Regards,
>> >> Yihui
>> >> --
>> >> Yihui Xie <xieyihui at gmail.com>
>> >> Phone: 515-294-6609 Web: http://yihui.name
>> >> Department of Statistics, Iowa State University
>> >> 3211 Snedecor Hall, Ames, IA
>> >>
>> >>
>> >>
>> >> On Tue, Sep 22, 2009 at 11:30 AM, zphnabr <zhengping at gmail.com> wrote:
>> >> >
>> >> > Hi folks,
>> >> >
>> >> > I am trying to do a clustering and generate a long dendrogram in R on
>> >> > Linux
>> >> > server:
>> >> > =========
>> >> >
>> >> > data<-read.table(file="mean_ratio.txt.noheader",row.names=1,sep="\t",quote="\"")
>> >> > hc<-hclust(dist(data),"ward")
>> >> >
>> >> > png(file="mean_ratio.txt.noheader.ward.png",bg="white",pointsize=8,width=32767,height=1536)
>> >> > plot(hc,hang=-1)
>> >> > dev.off()
>> >> > =========
>> >> >
>> >> > I found that 32767 is the largest width I can go.  I tried 32768 and
>> >> > the
>> >> > graphics becomes all black.  I need to go higher since even with
>> >> > 32767 width
>> >> > is not enough for the dendrogram.  What is the problem and what is
>> >> > the
>> >> > workaround?
>> >> >
>> >> > Thanks,
>> >> >
>> >> > zphnabr
>> >> > --
>> >> > View this message in context:
>> >> > http://www.nabble.com/R-PNG-graph-width-limitation-tp25530814p25530814.html
>> >> > Sent from the R help mailing list archive at Nabble.com.
>> >> >
>> >> > ______________________________________________
>> >> > 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