[R] Plot in real unit (1:1)

Eik Vettorazzi E@Vettor@zz| @end|ng |rom uke@de
Thu Jun 7 11:46:43 CEST 2018


How about this:

in2mm<-25.4 # scale factor to convert inches to mm

pdf("test.pdf",width=8.3,height=11.7)
pin<-par("pin")
plot(c(0,pin[1]*in2mm),c(0,pin[2]*in2mm), type="n", xaxs="i", yaxs="i")
lines(c(10,10),c(0,10))
text(11,5,"1 cm", adj=0)

lines(c(0,40),c(20,20))
text(20,24,"4 cm")

polygon(c(50,50,70,70),c(50,70,70,50))
text(60,60,"2x2 cm")
dev.off()

cheers

Am 06.06.2018 um 16:00 schrieb Christian Brandstätter:
> Dear List, 
> 
> Is it possible to plot in R in "real" units? I would like to draw a
> plot on A4 paper, where 1 plot unit would be a mm in reality. Is
> something like that possible? I would also like to be able to scale the
> plot in x and y direction. 
> Background: For a project I would have to draw around 65 fast sketches
> of elevation courves. 
> 
> Copied from here, due to no answer: https://stackoverflow.com/questions
> /50606797/plot-in-real-units-mm
> 
> Thank you!
> 
> ______________________________________________
> R-help using 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.
> 

-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistrasse 52
building W 34
20246 Hamburg

Phone: +49 (0) 40 7410 - 58243
Fax:   +49 (0) 40 7410 - 57790
Web: www.uke.de/imbe
--

_____________________________________________________________________

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. Dr. Uwe Koch-Gromus, Joachim Prölß, Martina Saurin (komm.)
_____________________________________________________________________

SAVE PAPER - THINK BEFORE PRINTING


More information about the R-help mailing list