### Examples of using mdaplotg
## 1. Show scatter plot for with height and weight values
## for males and females
data(people)
sex = people[, 'Sex']
fdata = cbind(people[sex == 1, 'Height'], people[sex == 1, 'Weight'])
mdata = cbind(people[sex == -1, 'Height'], people[sex == -1, 'Weight'])
colnames(fdata) = colnames(mdata) = c('Height', 'Weight')
pdata = list(fdata, mdata)
par(mfrow = c(2, 2))
mdaplotg(pdata, legend = c('female', 'male'))
mdaplotg(pdata, legend = c('female', 'male'), pch = c(17, 19), colmap = c('green', 'orange'))
mdaplotg(pdata, legend = c('female', 'male'), legend.position = 'topleft', colmap = 'gray')
mdaplotg(pdata, legend = c('female', 'male'), legend.position = 'topleft', show.labels = TRUE)
par(mfrow = c(1, 1))
## 2. Change tick values for x axis
mdaplotg(pdata, legend = c('female', 'male'), xticks = c(160, 175, 190),
xticklabels = c('Short', 'Medium', 'Tall'))
## 3. Show line plots with spectra from calibration and test set of the Simdata
data(simdata)
cdata = cbind(simdata$wavelength, t(simdata$spectra.c))
tdata = cbind(simdata$wavelength, t(simdata$spectra.t))
pdata = list(cdata, tdata)
par(mfrow = c(2, 2))
mdaplotg(pdata, type = 'l', legend = c('cal', 'test'))
mdaplotg(pdata, type = 'l', legend = c('cal', 'test'), xlab = 'Wavelength, nm', ylab = 'Log(1/R)')
mdaplotg(pdata, type = 'l', legend = c('cal', 'test'), lty = c(3, 2))
mdaplotg(pdata, type = 'l', legend = c('cal', 'test'), lwd = 2, colmap = c('green', 'orange'))
par(mfrow = c(1, 1))
Run the code above in your browser using DataLab