- R Data Visualization Cookbook
- Atmajitsinh Gohil
- 204字
- 2021-08-06 19:21:08
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.
- C++面向?qū)ο蟪绦蛟O(shè)計(第三版)
- Monkey Game Development:Beginner's Guide
- Learning PostgreSQL
- Pandas Cookbook
- Banana Pi Cookbook
- 高級語言程序設(shè)計(C語言版):基于計算思維能力培養(yǎng)
- Python編程實(shí)戰(zhàn)
- RabbitMQ Cookbook
- Access 2010數(shù)據(jù)庫應(yīng)用技術(shù)(第2版)
- Learning AngularJS for .NET Developers
- Python深度學(xué)習(xí)原理、算法與案例
- Flink技術(shù)內(nèi)幕:架構(gòu)設(shè)計與實(shí)現(xiàn)原理
- MyBatis 3源碼深度解析
- Visual Basic語言程序設(shè)計基礎(chǔ)(第3版)
- Microsoft HoloLens By Example