[R] loss of information in pdf plots

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Apr 17 16:35:50 CEST 2012



On 17.04.2012 16:16, Unger, Kristian, Dr. wrote:
> Thanks Uwe, you are right!
>
> The reason why it works fine now might be that the borders switch of the rect() function was set to "white" rather than NA when I sent my initial request. This obviously led to drawing of white borders that overlaid some of the tiny blue or red rectangles.
>
> However, it is still suspicious to me that the screen output looks quite different from the plot in the pdf.

Well, the screen is completely different than the pdf (the latter works 
rather precisely, the screen has typically not much more than 2000x1200 
pixels and the question is how to render effects that are smaller than a 
pixel ... Now the windows device and your pdf viewer decide to do 
different things (and R handles the devices slightly different as well, 
of course).

Uwe Ligges




>
> Thanks all for your great help!
>
> Best wishes
>
> Kristian
>
>
> Tel.: +49-89-3187-3515
>
> Am 17.04.2012 um 16:04 schrieb Uwe Ligges:
>
> As far as I can see, the recommended way of using
>
> pdf()
> plot
> dev.off()
>
> works precisely, just zoom in far enough so that your screen is able to
> display the gaps, e.g. by zooming in by 6400%
>
> Uwe Ligges
>
>
>
>
> On 17.04.2012 15:53, Unger, Kristian, Dr. wrote:
> Thanks Uwe. Please use the following below to reproduce the problem. Also, find the plots as I get them in my Dropbox:
>
> http://dl.dropbox.com/u/42940015/Rplot.pdf (plot as I get it when I use the "save as..." function from the Mac GUI menu.
> http://dl.dropbox.com/u/42940015/test.pdf (plot using the pdf() function.
>
> There should be red and blue boxes alternating with small white spaces in between. Actually neither the pdf from the screen plot nor the pdf() plot show exactly what I would expect.
>
> pdf("test.pdf",useDingbats=FALSE)
>
> ytp<- c(-89325387,-89216522,-60796604,-58334752,-57765318,-55659470,-55054287,-53883354,-50215659,-50118524,-50072127,-50045267,-49883861,-48749073,-48689425,-48304344,-48232108,-48200930,-47389665,-47334632,-47006453,-46801749,-46779857,-46500741,-34202088,-106271)
>
> ybp<-  c(-90163070,-89315653,-89212325,-60737864,-58320017,-57748589,-55640346,-54993254,-53873394,-50204330,-50104099,-50064400,-50006459,-49870854,-48727216,-48665687,-48296706,-48221116,-48190704,-47378997,-47321850,-46998634,-46789748,-46765297,-35147449,-33961185)
>
> col<- rep(c("blue","red"),13)
>
> plot(c(0, 200), c(0, -90163070), type= "n", xlab="", ylab="",axes=F)
>
>
> rect( 35+((p-1)*20), ytp,50+((p-1)*20),ybp,col=col,border=NA,main="hhh")
> dev.off()
>
>
> ________________________________
>
> Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology Group
> Abteilung für Strahlenzytogenetik / Research Unit of Radiation Cytogenetics
>
> Tel.: +49-89-3187-3515
>
> Am 17.04.2012 um 14:47 schrieb Uwe Ligges:
>
>
>
> On 17.04.2012 14:35, Unger, Kristian, Dr. wrote:
> Thanks Petr. Unfortunately this does not help.
>
>
> In that case, we need a reproducible example.
>
> Uwe Ligges
>
>
> Kristian
>
> Am 17.04.2012 um 14:18 schrieb Petr PIKAL:
>
> Hi
>
>
> Hi there
>
> is it possible that pdfs generated using the pdf() function with default
>
> settings leads to loss of information? I was plotting copy number
> changes
> from Agilent 180k data in form of rectangles (rect()) while each
> rectangle
> represents one region of copy number change. When plotting into a pdf I
> noticed that some very small rectangles do not appear (even after
> extensive zooming) in the pdf using the pdf() function. But they do when
>
> writing the screen output into a pdf using the GUI. Does anyone have
> some
> advice on this how I can plot pdfs without losing information?
>
> I am not sure if it has something to do with dingbats but you could try
> it.
>
> Set
>
> useDingbats=FALSE
>
> in you pdf call.
>
> Regards
> Petr
>
>
> Best wishes
>
> Kristian
>
> R version 2.14.0 (2011-10-31)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>
> locale:
> [1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] CGHregions_1.12.0 CGHcall_2.14.0    CGHbase_1.12.0    marray_1.32.0
> [5] limma_3.10.3      Biobase_2.14.0    DNAcopy_1.28.0    impute_1.28.0
>
> loaded via a namespace (and not attached):
> [1] tools_2.14.0
>
> ________________________________
>
> Arbeitsgruppenleiter Integrative Biologie / Head of Integrative Biology
> Group
> Abteilung für Strahlenzytogenetik / Research Unit of Radiation
> Cytogenetics
>
> Tel.: +49-89-3187-3515
>
>
> ________________________________
> Helmholtz Zentrum München
> Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
> Ingolstädter Landstr. 1
> 85764 Neuherberg
> www.helmholtz-muenchen.de<http://www.helmholtz-muenchen.de><http://www.helmholtz-muenchen.de>
> Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
> Geschäftsführer: Prof. Dr. Günther Wess und Dr. Nikolaus Blum
> Registergericht: Amtsgericht München HRB 6466
> USt-IdNr: DE 129521671
>
>    [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org<mailto:R-help at r-project.org><mailto: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.
>
>
>
> Helmholtz Zentrum München
> Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
> Ingolstädter Landstr. 1
> 85764 Neuherberg
> www.helmholtz-muenchen.de<http://www.helmholtz-muenchen.de><http://www.helmholtz-muenchen.de>
> Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
> Geschäftsführer: Prof. Dr. Günther Wess und Dr. Nikolaus Blum
> Registergericht: Amtsgericht München HRB 6466
> USt-IdNr: DE 129521671
>
> ______________________________________________
> R-help at r-project.org<mailto:R-help at r-project.org><mailto: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.
>
>
> ________________________________
> Helmholtz Zentrum München
> Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
> Ingolstädter Landstr. 1
> 85764 Neuherberg
> www.helmholtz-muenchen.de<http://www.helmholtz-muenchen.de>
> Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
> Geschäftsführer: Prof. Dr. Günther Wess und Dr. Nikolaus Blum
> Registergericht: Amtsgericht München HRB 6466
> USt-IdNr: DE 129521671
>
>
> ________________________________
> Helmholtz Zentrum München
> Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
> Ingolstädter Landstr. 1
> 85764 Neuherberg
> www.helmholtz-muenchen.de
> Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
> Geschäftsführer: Prof. Dr. Günther Wess und Dr. Nikolaus Blum
> Registergericht: Amtsgericht München HRB 6466
> USt-IdNr: DE 129521671
>



More information about the R-help mailing list