[R] Plotting with basic plot

David Winsemius dwinsemius at comcast.net
Sat Mar 16 19:46:08 CET 2013


On Mar 16, 2013, at 11:18 AM, Neuwirth Erich wrote:

> When I run this code fragment
> 
> x <- (0:100)/100
> y <- x^2
> plot(x,y,type="l",xlab=expression(x),ylab=expression(f(x)==x^2),
>  main="Quadratfunktion")
> 
> the exponent on the y-axis label is mutilated.
> How can the be changed with minimal effort?

 plot(x,y,type="l",xlab=expression(x),ylab="",
       main="Quadratfunktion")
 title(ylab = expression( f(x)==x^2 ), line=2)

> 
> ggplot2
> does not have this problem:
> 
> library(ggplot2)
> x <- (0:100)/100
> y <- x^2
> qplot(x,y,geom="line",xlab=expression(x),ylab=expression(f(x)==x^2),
>  main="Quadratfunktion")
> 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list