Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
R Data Visualization Cookbook

You're reading from  R Data Visualization Cookbook

Product type Book
Published in Jan 2015
Publisher
ISBN-13 9781783989508
Pages 236 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

R Data Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. A Simple Guide to R 2. Basic and Interactive Plots 3. Heat Maps and Dendrograms 4. Maps 5. The Pie Chart and Its Alternatives 6. Adding the Third Dimension 7. Data in Higher Dimensions 8. Visualizing Continuous Data 9. Visualizing Text and XKCD-style Plots 10. Creating Applications in R Index

Using par to beautify a plot in R


One quick and easy way to edit a plot is by generating the plot in R and then using Inkspace or any other software to edit it. We can save some valuable time if we know some basic edits that can be applied on a plot by setting them in a par() function. All the available options to edit a plot can be studied in detail by typing ?par in the command window.

How to do it…

In the following code, I have highlighted some commonly used parameters:

x=c(1:10)
y=c(1:10)
par(bg = "#646989", las = 1, col.lab = "black", col.axis = "white",bty = "n",cex.axis = 0.9,cex.lab= 1.5)
plot(x,y, pch = 20, xlab = "fake x data", ylab = "fake y data")

How it works…

Under the par() function, we have set the background color using the bg = argument. The las = argument changes the orientation of the labels. The col.lab and col.axis arguments are used to specify the color of the labels as well as the axis. The cex argument is used to specify the size of the labels and axis. The bty argument is used to specify the box style in R.

You have been reading a chapter from
R Data Visualization Cookbook
Published in: Jan 2015 Publisher: ISBN-13: 9781783989508
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}