[R] spacing problem in main title using car package scatterplot

John Fox jfox at mcmaster.ca
Thu Aug 29 23:56:40 CEST 2013


Dear Gerard,

Without your data, it's not possible to reproduce your problem exactly, but
it's clear that it isn't specific to the scatterplot() function in the car
package. For example, try

plot(1:10)
title(main=bquote(paste("Hypothesis 9.4.1\nBaseline XYZ with Disease
Activity (DAS28)\nat Month 18 (N=", 100 ,")")), adj=0)

You should be able to adapt the following solution:

plot(1:10)
mtext("Hypothesis 9.4.1\nBaseline XYZ with Disease Activity (DAS28)",
side=3, line=2)
mtext(paste("at Month 18 (N=", 100 ,")", sep=""), side=3, line=1)

I hope this helps,
 John

-----------------------------------------------
John Fox
McMaster University
Hamilton, Ontario, Canada




> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Gerard Smits
> Sent: Thursday, August 29, 2013 5:00 PM
> To: r-help at r-project.org
> Subject: [R] spacing problem in main title using car package
> scatterplot
> 
> Hi All,
> 
> I'm using R 3.0.0.  I'm trying to add the sample size of the paired
> data (calculated by a function n(), which returns a value of 70,
> correctly).
> 
> My main title works fine except that the '70' appears far to the right
> on the line as in:
> 
>   at Month 18 (N=                                       70)
> 
> Is there a way of left justifying the result of .(ss)?  or some other
> way of removing with whitespace between n= and 70?.
> 
> Thanks for any suggestions.
> 
> Gerard
> 
> 
> 
> 
> library (car)
> data<-read.csv("//users//smits//r_work//data.csv", header = TRUE)
> attach(data);
> 
> #######################################################################
> ###########################################
> ss<-n(m18_das28*b_score)
> 
> scatterplot(m18_das28~b_score,
>      jitter=list(x=1, y=1),
>      grid=F,
>      smooth=F,
>      las=1,
>      pch=c(1),
>      col='blue',
>      main=bquote(paste("Hypothesis 9.4.1\nBaseline XYZ with Disease
> Activity (DAS28)\nat Month 18 (N=",.(ss),")")),
>      xlab="Baseline XYZ",
>      ylab="Month 18 DAS28",
>      legend.plot=F)
> 
> ______________________________________________
> 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