Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7399369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:03:08+00:00 2026-05-29T04:03:08+00:00

I can’t find any documentation of the following problem I’m having with the axis

  • 0

I can’t find any documentation of the following problem I’m having with the axis labels in RGoogleMaps:

library(RgoogleMaps)
datas <- structure(list(LAT = c(37.875, 37.925, 37.775, 37.875, 37.875), 
                   LON = c(-122.225, -122.225, -122.075, -122.075, -122.025)), 
                   .Names = c("LAT", "LON"), class = "data.frame", 
                   row.names = c(1L, 2L, 3L, 4L, 5L))
# Get bounding box.
boxt <- qbbox(lat = datas$LAT, lon = datas$LON)
MyMap <- GetMap.bbox(boxt$lonR, boxt$latR, destfile = "Arvin12Map.png", 
maptype = "mobile")
PlotOnStaticMap(MyMap, lat = datas$LAT, lon = datas$LON, 
                axes = TRUE, mar = rep(4, 4))

When I run this on my computer the horizontal axis ranges from 300W to 60E, but the ticks in between aren’t linearly spaced (300W, 200W, 100W, 0, 100E, 160W, 60W).
Also, the vertical axis moves linearly from 300S to 300N. It seems that no matter what data I supply for datas, the axes are always labeled this way.

My question is:
1. Does this problem occur on other machines using this code?
2. Does anyone have an explanation for it?
and
3. Can anybody suggest a way to get the correct axes labels (assuming these are “incorrect”, but maybe i’m somehow misinterpreting the plot!)?

Thank you for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:03:08+00:00Added an answer on May 29, 2026 at 4:03 am
    1. Yes

    2. As @Andrie suggested, this appears to be a bug. When axes = TRUE, the degAxis() function called by PlotOnStaticMap() extracts the x and y plot coordinates of the pretty tickmarks found by axTicks(). degAxis() expects these coords to be in the coordinate system of the map, but rGoogleMaps returns them as pixel coordinates, calculated from a central origin. With a plot size of 640 x 640, the pretty tickmarks are assigned to -300, -200, -100, 0,100, 200, 300 in both E-W and N-S directions. You end up with 300W, 200W, 100W, 0, 100E, 160W, 60W, because the degreeLabelsEW() function called by degAxis() assumes that, given longitudes must fall within [-180, 180], any longitudes higher than 180 are in fact in the western hemisphere (e.g. 200E is 20 degrees eastward into the western hemisphere, i.e. 160W). Not sure why it doesn’t perform similarly with nonsensical N, S and W coordinates.

    3. A quick workaround, continuing with your MyMap object:

      PlotOnStaticMap(MyMap, lat = datas$LAT, lon = datas$LON, 
                      axes = FALSE, mar = rep(4.5, 4))
      
      # x-axis
      xrange <- MyMap$BBOX$ur[2] - MyMap$BBOX$ll[2]
      xticklength <- xrange / (length(axTicks(1)) - 1)
      xticklabs <- seq(MyMap$BBOX$ll[2], MyMap$BBOX$ur[2], xticklength)
      xticklabs <- parse(text = paste(sprintf('%.2f', abs(xticklabs)), 
          ifelse(xticklabs < 0, '*degree*W', '*degree*E'), sep=''))
      axis(1, at=axTicks(1), xticklabs, cex.axis=0.8)
      
      # y-axis
      yrange <- MyMap$BBOX$ur[1] - MyMap$BBOX$ll[1]
      yticklength <- yrange / (length(axTicks(2)) - 1)
      yticklabs <- seq(MyMap$BBOX$ll[1], MyMap$BBOX$ur[1], yticklength)
      yticklabs <- parse(text = paste(sprintf('%.2f', abs(yticklabs)), 
          ifelse(yticklabs < 0, '*degree*S', '*degree*N'), sep=''))
      axis(2, at=axTicks(2), yticklabs, cex.axis=0.8, las=1)
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any one tell, how to get the result of LINQ query contains group
Can someone thoroughly explain the last line of the following code: def myMethod(self): #
Can someone please explain to me why the output from the following code is
Can i define a text view and a list view inside a linear layout.
Can any one help me in sorting this out in sed/awk/perl Input file Start
Can anyone tell me how an IDE like NetBeans or any for that matter
Can a desktop .net library [Aforge.net] be used in a .Net CF 3.5 application?
Can someone help me? I am trying to do something like the following: #include
Can not find scala.actors package in latest milestones, while it still presents in scaladocs:
Can find why i get this error can someone help? package Android.data; public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.