2017-11-21 6 views
1

ich folgendes Konturplot habenWie zeichne ich eine Fülllinie in einem gefüllten Konturdiagramm und beschrifte es?

x <- c(0,25,50,75,100) 
y <- c(0,10,20) 
z <- matrix(c(12,12,13,12,5,12,5,5,5,12,5,12,13,14,15), nrow = 5, ncol = 3, byrow = TRUE) 
A <- matrix(seq(0, 100, by = 25), nrow = 3, ncol = 5, byrow = TRUE) #As x 
B <- matrix(seq(0,20, by = 10), nrow = 3, ncol = 5) #As y 
filled.contour(x,y,z, color=terrain.colors,# 
    plot.axes = { axis(1); axis(2); points(A,B)}) 

Wie ich ein Niveau Linie um den Pegel mit dem Wert 5 und beschriften und so etwas wie erhalten ziehen:

enter image description here

Antwort

1

können Sie Verwenden Sie contour in plot.axes. Es ist nicht möglich, die Zeile genau 5 hinzuzufügen, also habe ich stattdessen 5.01 verwendet und labels angegeben. Dies ist zumindest das Prinzip.

filled.contour(x, y, z, color = terrain.colors, 
       plot.axes = {axis(1); axis(2); points(A, B); 
       contour(x, y, z, levels = 5.01, labels = "5", col = "red", add = TRUE)}) 

enter image description here

0
library(fields) 
library(emdbook) 

x <- c(0,25,50,75,100) 
y <- c(0,10,20) 
z <- matrix(c(12,12,13,12,5,12,5,5,5,12,5,12,13,14,15), nrow = 5, ncol = 3, byrow = TRUE) 
A <- matrix(seq(0, 100, by = 25), nrow = 3, ncol = 5, byrow = TRUE) #As x 
B <- matrix(seq(0,20, by = 10), nrow = 3, ncol = 5) #As y 


image.plot(x,y,z) 
contour(x,y,z, 
    add=TRUE, lwd=2, cex=2) 
Verwandte Themen