kovthe
kovthe

Reputation: 41

Different results in base R plot with plot(x,y) and plot(x~y)

I am plotting a graph for a parameter x which represents energy usage vs y which represents data-time in %y-%m-%d %h:%m:%s format. Now, when I issue plot(x,y, other parameters) I get a box plot, and when I execute plot(x~y, other parameters) I get a completely different graph (with spikes). The only difference between the two plot commands is the way x,y parameters are passed.

I searched for relevant document but could not get useful information. Please share your thoughts on this.

Graph outputs with above commands

Upvotes: 0

Views: 2669

Answers (1)

Edgar Santos
Edgar Santos

Reputation: 3514

generic plot uses plot(x,y), where x and y are the coordinates in a simple scatter plots. plot(y~x) ?plot.formula is for plotting a formula. As @alistaire mentioned y~x

Upvotes: 1

Related Questions