[R] positions and margins differ between X11 and SVG device

Allan Engelhardt allane at cybaea.com
Tue Mar 8 21:37:04 CET 2011


Looks the same on my machine, albeit using svg() instead of CairoSVG - 
what version are you using?

One sometimes useful technique is to create the first graphics in a 
vector format (pdf, svg) and then use an editing program like Inkscape 
or Illustrator to do any touch-up before publication, as well as 
resizing and format conversion.

Good luck!

Allan

On 08/03/11 17:02, Frank Schwach wrote:
> Hi,
>
> I'm trying to get a plot ready for publication, which involves getting
> it to look nice at a rather small size and to fine-tune positioning all
> the labels and sizes of the margins.
> I realise that I may not be doing this the right way and I welcome any
> comments about better approaches to do this. What I have done so far is
> open an X11 device with the size I want for the final output and I have
> now managed to arrange all the elements as I wanted in the R script that
> draws the plot.
> Saving the plot to a bitmap format preserves all the positions and sizes
> but the resulting quality is too low. Saving it to svg (also tried
> CairoSVG) of course gives me excellent quality, but the positions and
> margins are all completely different from the X11 window. Now I'm
> wondering how others deal with this (surely common) situation?
> Figuring out the positions while working blindly (saving to svg file all
> the time and opening it again to see the result) surely can't be the way
> to adjust the positions. But what else can I do if X11 output and svg
> differ so much?
>
> In fact, here is a toy example to demonstrate the differences:
>
>
> x1=seq(0,2,by=0.01)
> y1=2*sin(2*pi*(x1-1/4))
>
> x11(width=1.67, height=2.28)
> plot(x1,y1)
>
> # looks completely different in svg (at least on my machine):
>
> CairoSVG(file="test.svg", width=1.67, height=2.28)
> plot(x1,y1)
> dev.off()
>
>
> Any help or general advice on formatting plots for publication would be
> very welcome!
>
> Cheers,
>
> Frank
>
>
>
>



More information about the R-help mailing list