[R] svg plot and dashed lines

Paul Murrell p.murrell at auckland.ac.nz
Sun Oct 10 02:55:50 CEST 2010


Hi

On 29/09/2010 11:15 p.m., Ivan Calandra wrote:
>    Dear users,
>
> When I boxplot(), the lines of the whiskers are dashed. However, when I
> save in an svg file, the dashed lines of the whiskers are not dashed
> anymore.
> How can I have the dashed lines in the svg file?
> I don't have this problem with a ps file, but I cannot edit such file as
> easily as an svg file. That's why I'd like to stick to the svg format.

Assuming you're on Windows, you could try something like ...

# Install the 'Cairo' package from CRAN
library(Cairo)
CairoSVG("test.svg")
boxplot(b~a, data=df)
dev.off()

... on a modern Linux system, this should simplify to ...

svg("test.svg"))
boxplot(b~a, data=df)
dev.off()

Paul

> Thanks in advance,
> Ivan
>
>
> df<- structure(list(a = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
> 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("A", "B"), class
> = "factor"), b = c(0.904439748839731, -0.855322875817714,
> -0.957288625102814, 0.130401502975395, -1.27765131101282,
> -2.08861064654457, 1.10234256081394, -2.05533035069656,
> -1.04529859053820, -0.0847903566670016, 1.02553030160793,
> 0.321170740199536, 1.87419854190502, -0.891404432182873,
> 0.968745913802415, -0.85229752730528, 0.641555656821046,
> 1.72455661053506, -0.523097596614304, 1.26729031187194)), .Names =
> c("a", "b"), row.names = c(NA, -20L), class = "data.frame")
>
> library(RSvgDevice)
> devSVG(file="test.svg")
> boxplot(b~a, data=df)
> dev.off()
>
>

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list