Issue to undertand plot funtion

Hello everyone,
I am studying R and I have an exercise about read the result of a plot.
library(dslabs)
data("olive")
head(olive)
plot(olive$palmitic, olive$palmitoleic)

you can see whats I am seeing and de question is "Plot the percent palmitic acid versus palmitoleic acid in a scatterplot. What relationship do you see?"

I am just putting the question, if it is necessary. what I really want to know is how to read

Please see FAQ: What's a reproducible example (`reprex`) and how do I do one?, and why it's important.

Fortunately, your question is simple enough not to require one to understand the issue

plot(mtcars$wt,mtcars$mpg)

Created on 2020-02-17 by the reprex package (v0.3.0)

This plot shows f(x) = y for x =wt and y =mpg. This is mileage (miles per gallon of fuel) against weight (in pounds), the x axis and the y axis, respectively.

What do you observe about the position of the mpg points as wt increases? Does it change? If so, how?

1 Like

With more weight we have less miles per gallon, that's seems like easy to read. but I have to types of data. The results can be linear or exponetial(positive or negative) right? in this case seems like linear negative right? is there any function that shows data in a linear or exponential way?

This can be done with the plot function. You should look through its documentation:

?plot.default

But here's the relevant parameter of the function:

log
a character string which contains "x" if the x axis is to be logarithmic, "y" if the y axis is to be logarithmic and "xy" or "yx" if both axes are to be logarithmic.

Continuing with technocrat's example...

plot(mtcars$wt, mtcars$mpg, log = "y")

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.