Customizing Your Plots
Customizing Your Plots
Customizing
Plots
Introduction to R
mercury
> mercury
temperature pressure
1
0
0.0002
2
20
0.0012
3
40
0.0060
4
60
0.0300
5
80
0.0900
6
100
0.2700
7
120
0.7500
8
140
1.8500
9
160
4.2000
10
180
8.8000
11
200 17.3000
...
19
360 806.0000
Introduction to R
Basic plot
> plot(mercury$temperature, mercury$pressure)
Introduction to R
Fancy plot
> plot(mercury$temperature, mercury$pressure,
horizontal axis label
xlab = "Temperature",
vertical axis label
ylab = "Pressure",
main = "T vs P for Mercury",
plot title
type = "o",
plot type
col = "orange")
Introduction to R
Fancy plot
> plot(mercury$temperature, mercury$pressure,
horizontal axis label
xlab = "Temperature",
vertical axis label
ylab = "Pressure",
main = "T vs P for Mercury",
plot title
type = "l",
plot type
col = "orange")
plot color
Introduction to R
Graphical Parameters
> plot(mercury$temperature, mercury$pressure, col = "darkgreen")
Introduction to R
Graphical Parameters
> plot(mercury$temperature, mercury$pressure)
Introduction to R
par()
> ?par
> par()
List of 72
$ xlog
:
$ ylog
:
$ adj
:
...
$ fin
:
$ font
:
$ font.axis:
$ font.lab :
...
$ yaxs
:
$ yaxt
:
$ ylbias
:
logi FALSE
logi FALSE
num 0.5
num
int
int
int
chr "r"
chr "s"
num 0.2
Introduction to R
par()
> par(col = "blue")
> plot(mercury$temperature, mercury$pressure)
Introduction to R
par()
> par(col = "blue")
> plot(mercury$temperature, mercury$pressure)
> plot(mercury$pressure, mercury$temperature)
> par()$col
[1] "blue"
Introduction to R
Introduction to R
Introduction to R
Introduction to R
Introduction to R
Introduction to R
INTRODUCTION TO R
Lets practice!