O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

You may want to generate two side by side scatterplots from the data in auto-mpg.csv. Run the following commands to do so:

> # first get old graphical parameter settings > old.par = par() > # create a grid of one row and two columns > par(mfrow = c(1,2)) > with(auto, {     plot(mpg ~ weight, main = "Weight vs. mpg")    plot(mpg ~ acceleration, main = "Acceleration vs. mpg")   }  ) > # reset par back to old value so that subsequent > # graphic operations are unaffected by our settings > par(old.par)  

The following diagram shows the two scatterplots:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required