微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用ggmap将R转换为ggmap轴的功能,将DD转换为DMS

如何解决使用ggmap将R转换为ggmap轴的功能,将DD转换为DMS

我一直在使用以下代码在我的地图上将DD转换为DMS。

scale_x_longitude <- function(xmin=-180,xmax=180,step=1,...) {
  xbreaks <- seq(xmin,xmax,step)
  xlabels <- unlist(
    lapply(xbreaks,function(x){
      ifelse(x < 0,parse(text=paste0(paste0(abs(dms(x)$d),"^{o}*"),paste0(abs(dms(x)$m)),"*W")),ifelse(x > 0,"*E")),abs(dms(x))))}))
  return(scale_x_continuous("Longitude",breaks = xbreaks,labels = xlabels,expand = c(0,0),...))
}

scale_y_latitude <- function(ymin=-90,ymax=90,step=0.5,...) {
  ybreaks <- seq(ymin,ymax,step)
  ylabels <- unlist(
    lapply(ybreaks,"*S"),"*N")),abs(dms(x))))}))
  return(scale_y_continuous("Latitude",breaks = ybreaks,labels = ylabels,...))
}  

在这里Revisiting the "Format latitude and longitude axis labels in ggplot"

找到了它

但是至少四个月以来,这些功能不再起作用。我收到以下错误

Error in grid.Call(C_textBounds,as.graphicsAnnot(x$label),x$x,x$y,: 
  annotation mathématique incorrecte

注释数学不正确可以翻译为“数学表达式不正确”

有人可以帮助我吗?

您真诚的, 亚历山大

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。