[R] graphic device Windows tickmarks

Duncan Mackay dulcalma at bigpond.com
Tue May 31 08:17:47 CEST 2016


Hi 

Without looking at the help guide I think there are restrictions on
resolution
and just in case of unit problems I worked in the default units

> png("test.png",units="in",width=12,height=12,res=300)
Error in png("test.png", units = "in", width = 12, height = 12, res = 300) :

  unable to start png() device
In addition: Warning messages:
1: In png("test.png", units = "in", width = 12, height = 12, res = 300) :
  unable to allocate bitmap
2: In png("test.png", units = "in", width = 12, height = 12, res = 300) :
  opening device failed
> 12*72
[1] 864
> png("test.png",width=864,height=834,res=150)
> plot(seq(0,1000),rep(10,1001),xaxt="n")
> axis(1,seq(0,1000,by=10),at=seq(0,1000,by=10),tick=TRUE)
> axis(1, at = thickticks, labels=FALSE, las = 1,lwd.ticks=2)
> dev.off()

Check ?postscript and the options as eps and pdf require different
arguments.
> postscript("test.eps", paper = "special", width = 12,height = 12)
> plot(seq(0,1000),rep(10,1001),xaxt="n")
> axis(1,seq(0,1000,by=10),at=seq(0,1000,by=10),tick=TRUE)
> axis(1, at = thickticks, labels=FALSE, las = 1,lwd.ticks=2)
> dev.off()

> pdf("test.pdf", paper = "special", width = 12,height = 12)
> plot(seq(0,1000),rep(10,1001),xaxt="n")
> axis(1,seq(0,1000,by=10),at=seq(0,1000,by=10),tick=TRUE)
> axis(1, at = thickticks, labels=FALSE, las = 1,lwd.ticks=2)
> dev.off()

All the above work for me on Win 7 32

platform       i386-w64-mingw32                           
arch           i386                                       
os             mingw32                                    
system         i386, mingw32

Similar to the above has worked on Win 64

Regards

Duncan


Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Christian
Brandstätter
Sent: Tuesday, 31 May 2016 05:24
To: r-help at r-project.org
Subject: [R] graphic device Windows tickmarks

Dear List,

I discovered an issue; when plotting (base) in R, the tickmark-labels 
are slightly off (Windows machine).

Thus, when saving the plot in R with x11() and dev(...) the 
plot-tickmarks shift, see the example below.

Session Info:

R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

With savePlot it works, but the graph quality is not as nice. Am I 
missing something here?


Example:
thickticks <- 
c(0,40,90,140,200,260,320,380,440,500,560,620,680,740,800,860,920,980)

x11(width=12,height=12)
plot(seq(0,1000),rep(10,1001),xaxt="n")
axis(1,seq(0,1000,by=10),at=seq(0,1000,by=10),tick=TRUE)
axis(1, at = thickticks, labels=FALSE, las = 1,lwd.ticks=2)

# plots
dev.print(device=png,"test.png",units="in",width=12,height=12,res=500) # 
won't display prop.
dev.print(device=postscript,"test.eps",width=12,height=12)  # won't 
display prop.
dev.print(device=pdf,"test.pdf",width=12,height=12)  # won't display prop.
savePlot("test_2.png",type="png") # displays prop.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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