# Probability Density Plot and Shading

This is an example on programming with S3 method. The results from this: plotting p.d.f. curve and shading the curve for selected interval(s). The functions are provided in pdfShading.R. Run the following command at R prompt (> ):

``` source("http://www.stat.wmich.edu/wang/R/egs/Pdf/pdfShading.R")
```
The R Data image will be saved (since the last line of the codes does just that).
And you're ready to run applications.

### Demos

The R codes in PdfDemo.R will produce 12 (acrobat) PDF files (Example01.pdf, ..., Example12.pdf) as results of individual examples. Examples are separable by copy/paste each code chunk. To run it all, do

``` source("http://www.stat.wmich.edu/wang/R/egs/Pdf/PdfDemo.R")
```
Use acrobat reader to view each graph.

### Sampling Distribution of Large Sample Proportion Example

The R codes in Prop1.R will produce 5 (acrobat) PDF files (Prop01.pdf, ..., Prop05.pdf). Programming on graphical elements in these plot is evidenced. Again, do

``` source("http://www.stat.wmich.edu/wang/R/egs/Pdf/Prop1.R")
```

### An Interactive Session on Using Pdf

The session as seen in the screen snapshot below will produce graphics as below. Note that, in the session, after submitting

``` > from <- locator(1)
```
the control is handed over to the graphics, asking user to identify a point (starting point of the arrow in this case). Left click mouse at an appropriate point.

While the graphics window is active (click inside it to make it active), do File → Save as → Png and respond to the dialog box accordingly to save a PNG file (Portable Network Graphics).
The graphics is given below:

2011-10-21