[R] Help in improving the style of R plots

Duncan Murdoch murdoch.duncan at gmail.com
Thu Nov 25 12:25:18 CET 2010


On 25/11/2010 5:38 AM, pilchat wrote:
>
> Dear all,
>
> I am running a MCMC on my data, and I want to plot the results of the
> simulation. I want to dedicate a page in the PS file for each element in
> my sample, and in each page I need to plot 8 quadrants.
>
> In attachment you find my first attemp (just the first page). Here are
> my troubles (I'm sorry if they are stupid, but I am a newby with R):
> -) I need to substitute the greek letters wherever you find the full
> spelling (I also need to substitute "Surface" with the greek Sigma letter)

See ?plotmath.  The general idea is that you would use

xlab = expression(alpha)

instead of

xlab = "alpha"


>
> -)in the top plots I need to write the "variable=median+-stddeviation
> (units)" in a more "readable" way: some characters overlap and I want to
> approximate the numebrs to the second decimal digit. This is how I have
> been trying so far: text(min(mchain[1,]),max(ndensity$y),substitute(
> Log(Surface)[med] ==nmed%+-%nstd,list(nmed=nmed,nstd=nstd) ),pos=4 )

You have some strange font problems. I would guess that you produced the 
plots by copying from the screen or another device:  don't do that, it 
gets the spacing wrong.  Use pdf() or postscript() to open the device 
and plot directly to it in the desired final size.

>
> -) plot (c): ticks, annotations and labels overlap, but they shouldn't.

Same problem as above.

> Here is the code:
> persp(d,col=fcol,zlim=zlim,theta=theta,phi=phi,zlab="density",xlab=xlab,ylab=ylab,main="",sub="(c)",ticktype="detailed")
>
> -) plot (e) and (f): I need to cancel plot (f) and place plot (e) at the
> center of the bottom row

The layout() function might help with this.

> -) when I close the R session, the content of the PS file disappears.
> How can I retain the graphics output after closing R?

I think you are misunderstanding what's going on.  R deletes temporary 
files when it closes, but you wouldn't normally create a plot in a 
temporary file.

Duncan Murdoch

>
> Can you help me in getting what I wish? Any help is greatly appreciated.
>
> Thanks a lot
>
> Gaetano
>
>
>
> ______________________________________________
> 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