2017-11-29 68 views
1

パプアニューギニアの海底地形図をRで作成しようとしましたが、地図をプロットすると、すべての輪郭で非常に忙しく見えます。私は土地を一色にし、水を二番目の色にしたいので、地図はとてもシンプルに見えます。私は自分のrコードとそれを使用するときに作成されたマップを添付しています。色や輪郭がほとんどないrで地形図をプロットするにはどうすればいいですか?

ベスト、 シャノン

library(marmap) 
PNG_Map <- getNOAA.bathy(lon1 = 144, lon2 = 158, lat1 = -14, lat2 = -8, 
resolution = 1) 
summary(PNG_Map) 
library(zoom) 

white <- ("white") 
black <- ("black") 

par(mfrow=c(1,1)) 

plot(PNG_Map, image = TRUE, land = TRUE, xlim=c(148.75,154), 
ylim=c(-14, -8.75), xaxs = "i", yaxs = "i", lty = c(1, 1, 1), lwd = 
c(0.6, 0.6, 1.2), bpal = list(c(0, max(PNG_Map), black), 
c(min(PNG_Map),0 , white))) 

Map of PNG

答えて

0

私はあなたがこのようにそれを試すことができると思います。また、ドキュメントについて?plot.bathyをチェック

pal1 <- list(
    c(min(PNG_Map), 0, "purple", "blue", "lightblue"), 
    c(0, max(PNG_Map), "yellow", "brown")) 
pal2 <- list(
    c(min(PNG_Map), 0, "blue"), 
    c(0, max(PNG_Map), "yellow")) 
plot_it <- function(pal, n, ...) { 
    plot(PNG_Map, image=TRUE, land = TRUE, bpal = pal, n = n, 
     xlim=c(148.75,154), ylim=c(-14, -8.75), ...) 
} 
par(mfrow = c(3, 1), mar = c(0,0,0,0), bty="n", xaxt="n", yaxt="n") 
plot_it(pal1, 1) 
plot_it(pal2, 10) 
plot_it(pal2, 10, deep=min(PNG_Map), shallow=0, step = 1000) 

enter image description here

1

plot.bathy()関数を複数回呼び出すことで、マップを作成することを強くお勧めします。そうすれば、必要に応じてアイソバスを追加することができます。ここにあなたのコードに基づいて、2つの例である(私が削除した不要な線や引数):enter image description here

初めてplot.bathy()を呼び出すときに一緒にプレイするための鍵引数

library(marmap) 
PNG_Map <- getNOAA.bathy(lon1 = 144, lon2 = 158, lat1 = -14, lat2 = -8, resolution = 1)  

# --- Black and white --- 
plot(PNG_Map, image = TRUE, land = TRUE, xlim=c(148.75,154), ylim=c(-14, -8.75), n=100, lwd = 0.03, bpal = list(c(0, max(PNG_Map), grey(.3)), c(min(PNG_Map),0 , "white"))) 
plot(PNG_Map, deep=0, shallow=0, lwd = 0.6, add=T) # Add coastline 
plot(PNG_Map, deep=-200, shallow=-200, lwd = 0.4, drawlabels=T, add=T) # Add -200m isobath 
plot(PNG_Map, deep=-2000, shallow=-2000, lwd = 0.4, drawlabels=T, add=T) # Add -2000m isobath 


# --- With colors --- 
# Creating color palettes 
blues <- c("lightsteelblue4", "lightsteelblue3", "lightsteelblue2", "lightsteelblue1") 
greys <- c(grey(0.6), grey(0.93), grey(0.99)) 

plot(PNG_Map, image = TRUE, land = TRUE, xlim=c(148.75,154), ylim=c(-14, -8.75), lwd = 0.03, bpal = list(c(0, max(PNG_Map), greys), c(min(PNG_Map),0 , blues))) 
plot(PNG_Map, deep=0, shallow=0, lwd = 1, add=T) # Add coastline 
plot(PNG_Map, deep=-200, shallow=-200, lwd = 0.4, drawlabels=T, add=T) # Add -200m isobath 
plot(PNG_Map, deep=-2000, shallow=-2000, lwd = 0.4, drawlabels=T, add=T) # Add -2000m isobath 

enter image description here は以下のとおりです。

  • n=:指定:
  • lwd=をプロットするisobathsの大まかな数を指定します等深線ラインの幅は
  • lukeAによって示唆されるように

?plot.bathyvignette("marmap")vignette("marmap-DataAnalysis")を確認してください。そこにはたくさんの例があります。

関連する問題