I have a dataframe with this structure:
y x z
1 33.12 27 0.1089740
2 33.38 27 0.1057790
3 33.62 27 0.1068951
4 33.88 27 0.1041899
5 34.12 27 0.1173378
6 34.38 27 0.1261724
x values range between 27 and 55. I have the following plot:
library(lattice)
library(rasterVis)
contourplot(z ~ x*y, data = dat,
xlab = 'Chronology (kya)', ylab = 'Longitude (º)',
panel = panel.levelplot.raster,
par.settings = rasterTheme(), colorkey = FALSE)
I need to change the x labels: I'd need to show only the labels 55, 45, 40, 35, 30 (but all values of data represented in the plot).
You can use scales
within contourplot
:
contourplot(z ~ x * y, data = dat,
xlab = 'Chronology (kya)', ylab = 'Longitude (º)',
panel = panel.levelplot.raster,
par.settings = rasterTheme(),
colorkey = FALSE,
scales = list(x = list(at = seq(30, 55, 5))))