# R: [R] How to plot this

Guazzetti Stefano Stefano.Guazzetti at ausl.re.it
Wed Nov 17 09:28:28 CET 2004

```Hi,
looking at "?plot.density" you will find a "zero.line" argument:
set it to FALSE and no gray lines will appear in the plot.

plot(density(y), zero.line = F,  main=" ", ann = F,
xlim = c(0, 4), ylim = c(0, 1), lty = 2, col = 4, axes = F)
mtext(side = 1, line = 0, text = "Environmental gradient" )
mtext(side = 2, line = 0, text = "Abundance of species"  )
arrows(0, 0, 4, 0,  angle = 15, length = 0.1, lwd=2)
arrows(0, 0, 0, 1,  angle = 15, length = 0.1, lwd=2)

Hope this helps
Stefano

> -----Messaggio originale-----
> Da: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]Per conto di Jin.Li at csiro.au
> Inviato: mercoledÃ¬ 17 novembre 2004 7.39
> A: r-help at stat.math.ethz.ch
> Oggetto: [R] How to plot this
>
>
> Hi there,
>
>
>
> I produced a plot using the following codes:
>
>
>
> y<-rnorm(1000, 2, 0)
>
> x0<-c(0, 0)
>
> y0<-c(0, 0)
>
> y1<-c(0, 1)
>
> x1<-c(0, 4)
>
> plot(density(y), ylab="Abundance of species", xlab="Environmental
>
>    xlim=c(0, 4), ylim=c(0, 1), lty=2, col=4, xaxt="n", yaxt="n",
> frame.plot=F)
>
> lines(x0, y1) # add an axis
>
> lines(x1, y0) # add an axis
>
> arrows(3.95, 0, 4, 0,  angle = 15, length = 0.1)
>
> arrows(0, 0.98, 0, 1,  angle = 15, length = 0.1)
>
>
>
> labels closer to the axes. And also appreciate any
> suggestions on how to
> make those arrows look nicer, e.g. a filled small arrow for each axis,
> like what from points(0, 1,   pch=17), but a slightly narrowed one.
> Thanks.
>
>
>
> Regards,
>
>
>
> Jin Li
>
> ========================
>
> Jin Li, PhD
>
> Climate Impacts Modeller
>
> CSIRO Sustainable Ecosystems
>
> Atherton, QLD 4883, Australia
>
> ========================
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help