7. Graphik
==========
(siehe "An Introduction to R", Sec 12)
	data(mtcars)

	summary(mtcars)
	summary(mtcars$mpg)
	attach(mtcars)
	summary(mpg)

	hist( mpg)

	hist( mpg, prob=T)
	lines( density( mpg))    ## density ist im Grunde auch ein relatives Histogramm, aber feiner
	rug(mpg)

	## box um 1. und 3. Quartil; median in der Mitte
	## die whiskers umfassen die "weitesten" Datenpunkte, die range+IQR
        ## weit von den 1. bz. 3 Quartilen entfernt liegen (default: range=1.5)
	boxplot(mpg)
	boxplot(mpg,cyl)
	boxplot(mtcars)

	plot( mpg)

	qqplot ( mpg, hp)

	# scatterplot: plot( mtcars[,c("mpg","hp")])

    Parameter

	par("col")

	oldcol <- par("col")
	par( "col" = "green")
	plot( mpg)
	par( "col" = oldcol)
	plot( mpg)
	plot( mpg, type = "l")

	## ohne achsen-Beschriftung. macht noch nicht so Sinn
	plot( mpg, axes = FALSE, ylab = "miles/gallon", xlab="")
        axis( side=1, at=1:length(rownames(mtcars)), labels=rownames(mtcars), las=2)

	## Raetsel: warum erscheinen nur manche Automarken?
	par(mfrow=c(1, 1), mai=c(3, 0.5, 0.5, 0))
	plot( mpg, axes = FALSE, ylab = "miles/gallon", xlab="")
        axis( side=1, at=1:length(rownames(mtcars)), labels=rownames(mtcars), las=2)
	axis(side=2)

	hist( mpg, prob=T)
	lines( density( mpg), "col" = "green")    
        rug(mpg, "col" = "blue")

    mehrere Plots auf einer Seite 

	par(mfrow=c(2,1))
	boxplot(mpg)
	boxplot(cyl)

    Graphiken in Dateien

	pdf( "ausgabe.pdf")
	hist( mpg, prob=T)
        lines( density( mpg), "col" = "green")
        rug(mpg, "col" = "blue")
	dev.off()

     es gibt auch interaktive Graphik, 3D-Graphik


8. Verteilungen
===============

	par(mfrow=c(2, 1),oma=c(0,0,1,0))

	x <- seq(-10,10,0.01)

	plot(x,dnorm(x,mean=0,sd=1),type="l", ylab="N(x|0,1)" )
	plot(x,dnorm(x,mean=4,sd=3),type="l", ylab="N(x|0,3)" )

	mtext("normal distribution", outer=TRUE)
	par(mfrow=c(1, 1))
	x <- rnorm(100)
	qqnorm(x)
	qqline(x)

	x <- rnorm(1000)
	qqnorm(x)



(siehe "An Introduction to R", Sec 8)
