[R] R PNG graph width limitation

Henrik Bengtsson hb at stat.berkeley.edu
Tue Sep 22 21:05:19 CEST 2009


You *have to* report sessionInfo() when you ask for this kind of help.

It might be that the PNG is actually generated, but it is the viewer
that cannot display it.  You can check with other viewers or editors.
You can also try to downscale using ImageMagick, e.g.

 convert -geometry 10% large.png large_small.png

and check if large_small.png contains the all of the image (the there
is nothing wrong with your PNG driver).

I know that for instance Firefox has some limitation of PNG size and
the first symptoms are typically that it only show the top part of the
image.  For us it occurred around ~40,000px (or so) wide with a height
of 400px.  There's no easy formula for predicting when it occurs.

Example (Firefox v3.x only):

http://www.stat.berkeley.edu/share/hb/aroma.affymetrix/demo/reports/Affymetrix_2006-TumorNormal/ACC,+300,RMA,A+B,w,FLN,paired/ChromosomeExplorer.html

Try one of the large zooms, e.g. x0128.  You probably won't see anything.

The only solution I know of is to tile smaller images into one big one
(think Google Maps).  Never had time to go down this path.  Major
work.

My $.10

/Henrik


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.
>>> >
>>
>>
>
> ______________________________________________
> 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