Data visualization in R: Plotting a function

With the function curve you may plot a function. The following example shows how to use this function.
 
curve(x^3, from = -10 , to = 10, main = ‚f(x)=x^3‘, lwd = 2)

R26_a

The curve function offers the option add = TRUE. This will allow you to add a curve to an existing plot. The following example will add two more functions to the existing one.
 
curve(x^3, from = -10 , to = 10, main = ‚Several functions in one plot‘, lwd = 2)
curve(2*x^3+300, lwd = 2, add = TRUE)
curve(x^3+10*x^2-500, lwd = 2, add = TRUE)

R26_b

Werbung
Dieser Beitrag wurde unter R veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit deinem WordPress.com-Konto. Abmelden /  Ändern )

Facebook-Foto

Du kommentierst mit deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s