Grafiken und Statistik in R
Grafiken und Statistik in R
Grafiken und Statistik in R
Erfolgreiche ePaper selbst erstellen
Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.
3.1 E<strong>in</strong>stellungen Zusätze 3 Grafik<br />
plot(x, s<strong>in</strong>(x), type = "l", ylim = c(-1.2, 1.8), col = 3, lty = 2) # Graph zeichnen<br />
po<strong>in</strong>ts(x, cos(x), pch = 3, col = 4) # Punkte zeichnen<br />
l<strong>in</strong>es(x, tan(x), type = "b", lty = 1, pch = 4, col = 6) # L<strong>in</strong>ie mit x zeichnen<br />
legend(-1, 1.9, # oder "bottomright", "bottom", "bottomleft", "left"usw.<br />
c("s<strong>in</strong>", "cos", "tan"), # Text<br />
pt.bg = c(3,4,6), # Punkt H<strong>in</strong>tergr<strong>und</strong><br />
lty = c(2, -1, 1), # L<strong>in</strong>ientyp auf Seite 29<br />
pch = c(-1, 3, 4), # Punkttyp auf Seite 30<br />
merge = TRUE, # Punkte <strong>und</strong> L<strong>in</strong>ien zusammenfügen<br />
bg='gray90' # Farbe H<strong>in</strong>tergr<strong>und</strong><br />
)<br />
rm(x) # x wieder löschen<br />
example(legend) # Bsp. ansehen<br />
� Optionen legend(...): legend(-1, 1.9,...) x, y Koord<strong>in</strong>ate (oder locator(n) benutzten); legend(x, y, legend,...) Text od.<br />
Ausdruck c(...) kann benutzt werden; fill='gray50' kle<strong>in</strong>e Farbige Box neben Legendentext; col="gray50" Farbe für Legenden-<br />
Punkte/L<strong>in</strong>ien; lty=2, lwd=1.5, pch=16 L<strong>in</strong>ientyp, -breite, Punktform (s. par(...) auf Seite 28), bty="n" ke<strong>in</strong> Rahmen zeichnen,<br />
bg="gray50" Legenden-H<strong>in</strong>tergrunfarbe (geht nur, wenn bty="n"); pt.bg="red" Punkth<strong>in</strong>tergr<strong>und</strong>farbe;, cex=1.2 relative Größenangabe;<br />
xjust=0 (Werte von 0...1) Ausrichtung zur Lokalisation (↔) von x, y: 0- l<strong>in</strong>ks, 0.5- Mitte, 1- rechts; yjust=0 dasselbe nur ↕ ; x.<strong>in</strong>tersp=1.2<br />
relativer ↔ Abstand; y.<strong>in</strong>tersp=1.2 dasselbe nur ↕; adj=2 Textausrichtung – je größer die Zahl, desto weiter l<strong>in</strong>ks (nützlich für<br />
mathematische Ausdrücke s. auf dieser Seite)<br />
# Farbwerte <strong>in</strong> Legenden color.legend(..)<br />
# example(color.legend) # Beispiel ansehen<br />
library(plotrix) # Paket laden<br />
par(mar=c(7,4,4,6)) -> paralt # etwas mehr Platz (s.S.28)<br />
testcol