Commit c5ab1883 authored by Burkhardt Rockel's avatar Burkhardt Rockel

v2.1.3

correct bug in plotting flag_values and flag_meanings<br>
affected modules:

* plotmap.R
* plot_colourbar.R
parent 495e2ccc
......@@ -12,7 +12,6 @@ function(levs, cols, side=1, ylab="", labels=NULL,
# if sea.col is set, the colourbar is prolonged by one
# colour with the uncentered label sea underneath
# Check triangle_ends
if (!is.null(triangle_ends) && (!is.logical(triangle_ends) || length(triangle_ends) != 2)) {
stop("Parameter 'triangle_ends' must be a logical vector with two elements.")
}
......@@ -77,9 +76,10 @@ function(levs, cols, side=1, ylab="", labels=NULL,
}
} else {
#... no triangles at the ends
image(1:ncols, 1, lev.arr, axes=F, breaks=1:(ncols+1)-0.5, col=cols,
ylab=ylab, xlab=xlab, ...)
if (!is.na(border)) abline(v=1:(ncols-1) + 0.5, col=border)
if (!is.na(border)) abline(v=1:(ncols-1) + 0.5, col=border)
}
} else {
#... colorbar left side=2 or right side=4
......@@ -135,6 +135,7 @@ function(levs, cols, side=1, ylab="", labels=NULL,
}
}
if (center){
at.lev <- seq(1+sea.add,ncols,nn)
if (is.null(labels)){
......@@ -184,7 +185,7 @@ function(levs, cols, side=1, ylab="", labels=NULL,
}
`plot_colourbar.plotmap` <-
function(x, incl.units=T, side=1, cex.axis=1, labels=NULL, ...){
function(x, incl.units=T, side=1, cex.axis=1, labels=NULL, center=F, ...){
if (!is.null(x$flag_values)){
center <- TRUE
labels <- x$flag_values
......@@ -192,10 +193,9 @@ function(x, incl.units=T, side=1, cex.axis=1, labels=NULL, ...){
labels <- x$flag_meanings
}
}
las<-c(1,3,1,3)
plot_colourbar(x$lev, x$col, sea.col=x$sea.col, sea.lab=x$sea.lab, side=side,
cex.axis=cex.axis, labels=labels, ...)
cex.axis=cex.axis, labels=labels, center=center, ...)
# plot unit-string in axis
if (incl.units){
......
......@@ -210,9 +210,12 @@ function(file, sponge=8,
if (is.null(flag_values)){
levs <- pretty(data, 20)
} else {
levs <- approx(seq(along=flag_values), flag_values,
0.5 + 0:length(flag_values), yleft=min(flag_values)-diff(flag_values[1:2]),
yright=max(flag_values)+diff(flag_values[length(flag_values) - 0:1]))$y
flags<-data.frame(flag_values=flag_values, flag_meanings=flag_meanings)
flag_values<-as.vector(flags[order(flags$flag_values),][,1])
flag_meanings<-as.vector(flags[order(flags$flag_values),][,2])
levs <- approx(seq(along=flag_values), flag_values,
0.5 + 0:length(flag_values), yleft=2*flag_values[1]-flag_values[2],
yright=2*flag_values[length(flag_values)]-flag_values[length(flag_values)-1])$y
}
}
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment