• R语言绘制两种不同形式的投影方法效果图


    library(plot3D)
    
    par(mfrow = c(1, 1))
    panelfirst <- function(pmat) {
      zmin <- min(-quakes$depth)
      XY <- trans3D(quakes$long, quakes$lat,
                    z = rep(zmin, nrow(quakes)), pmat = pmat)
      scatter2D(XY$x, XY$y, col = "black", pch = ".",
                cex = 2, add = TRUE, colkey = FALSE)
      xmin <- min(quakes$long)
      XY <- trans3D(x = rep(xmin, nrow(quakes)), y = quakes$lat,
                    z = -quakes$depth, pmat = pmat)
      scatter2D(XY$x, XY$y, col = "black", pch = ".",
                cex = 2, add = TRUE, colkey = FALSE)
    }
    
    
    library(scales)
    library(RColorBrewer)
    library(fields) 
    colormap <- colorRampPalette(rev(brewer.pal(11,'RdYlGn')))(100)#
    
    index <- ceiling(((prc <- 0.7 * quakes$mag/ diff(range(quakes$mag))) - min(prc) + 0.3)*100)
    for (i in seq(1,length(index)) ){
      prc[i]=colormap[index[i]]
    }
    
    
    pmar <- par(mar = c(5.1, 4.1, 4.1, 6.1))
    with(quakes, scatter3D(x = long, y = lat, z = -depth, #bgvar = mag,
                           pch = 21, cex = 1.5,col="black",bg=prc,
                           xlab = "longitude", ylab = "latitude",
                           zlab = "depth, km", 
                           ticktype = "detailed",#bty = "f",box = TRUE,
                           panel.first = panelfirst,
                           theta = 140, phi = 20, d=1.5,
                           colkey = FALSE)#list(length = 0.5, width = 0.5, cex.clab = 0.75))
    )
    colkey (col=colormap,clim=range(quakes$mag),clab = "Richter", add=TRUE, length=0.5,side = 4)
    
    
    #--------------------------------------------------------------------
    pmar <- par(mar = c(5.1, 4.1, 4.1, 6.1))
    with(quakes, scatter3D(x = long, y = lat, z = -depth, #bgvar = mag,
                           pch = 21, cex = 1.5,col="black",bg=prc,
                           xlab = "longitude", ylab = "latitude",
                           zlab = "depth, km", 
                           ticktype = "detailed",bty = "f",box = TRUE,
                           panel.first = panelfirst,
                           theta = 140, phi = 20, d=3,
                           colkey = FALSE)#list(length = 0.5, width = 0.5, cex.clab = 0.75))
    )
    colkey (col=colormap,clim=range(quakes$mag),clab = "Richter", add=TRUE, length=0.5,side = 4)
    
    #--------------------------------------------------------------------
    pmar <- par(mar = c(5.1, 4.1, 4.1, 6.1))
    with(quakes, scatter3D(x = long, y = lat, z = -depth, #bgvar = mag,
                           pch = 21, cex = 1.5,col="black",bg=prc,
                           xlab = "longitude", ylab = "latitude",
                           zlab = "depth, km", 
                           ticktype = "detailed",#bty = "f",box = TRUE,
                           panel.first = panelfirst,
                           theta = 140, phi = 20, d=30,
                           colkey = FALSE)#list(length = 0.5, width = 0.5, cex.clab = 0.75))
    )
    colkey (col=colormap,clim=range(quakes$mag),clab = "Richter", add=TRUE, length=0.5,side = 4)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Set1')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Set2')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Set3')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Pastel1')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Pastel2')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Blues')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Reds')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Accent')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'Paired')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'YlOrRd')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'PuBu')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'BuPu')))(100)#
    
    • 1

    在这里插入图片描述

    colormap <- colorRampPalette(rev(brewer.pal(11,'YlOrBr')))(100)#
    
    • 1

    在这里插入图片描述

  • 相关阅读:
    需永远在线的游戏公司,如何在线替换开源存储?
    并发编程系列之Lock锁可重入性与公平性
    MySQL深分页
    Ae 效果:CC Overbrights
    【LeetCode】16. RansomNode·赎金信
    JS优化多分支结构(经典)
    Mac Git 如何设置ssh key
    css:为什么我设置宽高百分比不生效
    用20行python写一个最简单的网站
    206.反转链表
  • 原文地址:https://blog.csdn.net/m0_38127487/article/details/127945562