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 8275131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:58:17+00:00 2026-06-08T07:58:17+00:00

This will be cross posted on R’s mailing list. I have the map as

  • 0

This will be cross posted on R’s mailing list.

I have the map as a png, so I won’t be using the get_map function.
I have extracted the raster data from the png, and I wish to load the map as it is on the display of R, and then I would like to plot a point on it.

So, here’s the way I have tried ggmaps. The program is compiling fine. Problem here is that there isn’t any output being shown.

library (png)
library (ggmap)

latitude  = c(40.702147,40.718217,40.711614)
longitude = c(-74.012318,-74.015794,-73.998284)

# Reads a PNG and outputs a raster array.
img <- readPNG (system.file ("img", "My.png", package="png"))

df <- data.frame (latitude, longitude)

# img: raster array read from the map png.
ggimage (img, fullpage = TRUE) + geom_point (data = df, aes_auto (df), size = 2)

qplot (latitude, longitude, data = df, colour = I("red"), size = I(3))

Of course I am doing something wrong. Please point out.

> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggmap_2.1     ggplot2_0.9.1 png_0.1-4    

loaded via a namespace (and not attached):
 [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2       grid_2.15.1       
 [5] labeling_0.1       MASS_7.3-18        memoise_0.1        munsell_0.3       
 [9] plyr_1.7.1         proto_0.3-9.2      RColorBrewer_1.0-5 reshape2_1.2.1    
[13] RgoogleMaps_1.2.0  rjson_0.2.8        scales_0.2.1       stringr_0.6       
[17] tools_2.15.1      
> 

EDIT: I have found an error.
Actually I was first running it with source (uff.R), and this command didn’t show any error. Then I tried Rscript.

anisha@linux-y3pi:~> Rscript uff.R
Loading required package: ggplot2
Loading required package: methods
Error in eval(expr, envir, enclos) : object 'x' not found
Calls: print ... sapply -> lapply -> eval.quoted -> lapply -> FUN -> eval
Execution halted
  • 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-06-08T07:58:20+00:00Added an answer on June 8, 2026 at 7:58 am

    Your ggimage is failing because there’s no x and y in it. Rename your lat-long coords to x and y. Here is a completely reproducible example. This is basic ggplot stuff:

    > library(png)
    > library(ggplot2)
    > img <- readPNG(system.file("img", "Rlogo.png", package="png"))
    > latitude  = c(40.702147,40.718217,40.711614)
    > longitude = c(-74.012318,-74.015794,-73.998284)
    > df <- data.frame (x=longitude,y=latitude)
    > qplot(x,y,data = df, colour = I("red"), size = I(3))
    

    Run those commands on your command line and you should see a plot. Possible reasons for failing are:

    • Your R doesn’t have an X11 connection to your display. Is this all running on a local Linux machine? You haven’t connected to a server? If R can’t pop up a graphics window it will probably try and create an Rplots.pdf file.
    • You are running in a script which isn’t printing. Wrap all ggplot, grid, and lattice graphics functions that you want to produce output in print() function calls. This is a FAQ, I think. Paul Hiemstra put this as an answer but then deleted it…
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is already cross-posted at MS Connect: https://connect.microsoft.com/VisualStudio/feedback/details/560451 I am attempting to override the
I have thread that monitor the status of the device( using i/o ). This
I've posted this in the CodeIgniter forum and exhausted the forum search engine as
Imagine I have this object (written with Ruby literals) stored in a MongoDB: {tags
I'm sure this will be ridiculously simple, but whatever... I'm trying to display a
In my domain, I have 2 bounded contexts that are relevant to this question:
Not sure if this will get closed as not a real question but I
i have spent a few hours on this to no avail. I have an
Using jQuery UI I have two radio buttons, Approve/Reject, which I would like to
I have a class which i realized will not always correctly instantiate and as

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.