New_to_this New_to_this - 1 year ago 86
R Question

Understanding semantics based on "plot"

I'm fooling around with

I = iris = "plot", args = c(I$Sepal.Length ~ I$Sepal.Width))
# This seems fine

p = list(x = I$Sepal.Length, y = I$Sepal.Width) = "plot", args = p)
# This looks weird

p1 = list(x = I$Sepal.Length, y = I$Sepal.Width, xlab = "") = "plot", args = p1)
# A bit less weird

p2 = list(x = I$Sepal.Length, y = I$Sepal.Width, xlab = "", ylab = "") = "plot", args = p2)
# And this gives the same as the first

So why is it, that I have to supply the axis labels to surpress all those numbers I get when using

Answer Source

What you are seeing is what R puts on the axis labels when it can't get any other naming info from the arguments. If you do:


then the plot will have to use the vector values as the axis labels.

When using, the names in the list arguments are matched to the names of the arguments of the function called. So there's no names left for the axis labels, just the values. At that point the fact that the data came from I$Sepal.width is long gone, its just a vector of values.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download