Tuesday, October 28, 2014

Making a plot in R

Making a plot in R
First I had to figure out demos.
> demo(stats)
Error in demo(stats) : No demo found for topic ‘stats’
> demi(memisc)
Error: could not find function "demi"
> demo(memisc)
Error in demo(memisc) : No demo found for topic ‘memisc’
> demo(graphics)

Turns out, you can only call demo() on a package you have installed.
Well then.
>demo(graphics)

This is what R gave me then:

> abline(h = 0, col = gray(.90))

> lines(x, col = "green4", lty = "dotted")

> points(x, bg = "limegreen", pch = 21)

> title(main = "Simple Use of Color In a Plot",
+       xlab = "Just a Whisper of a Label",
+       col.main = "blue", col.lab = gray(.8),
+       cex.main = 1.2, cex.lab = 1.0, font.main = 4, font.lab = 3)

> ## A little color wheel. This code just plots equally spaced hues in
> ## a pie chart. If you have a cheap SVGA monitor (like me) you will
> ## probably find that numerically equispaced does not mean visually
> ## equispaced.  On my display at home, these colors tend to cluster at
> ## the RGB primaries.  On the other hand on the SGI Indy at work the
> ## effect is near perfect.
>
> par(bg = "gray")

> pie(rep(1,24), col = rainbow(24), radius = 0.9)

So now I am going to try to make my own plot.

No comments:

Post a Comment