Newbie Q -- error in ggplot (plot_map

hey all, I keep getting an error when trying to solve for this.. the error I'm getting is "Error in ggplot(plot_map, aes(lng, lat)) : object 'plot_map' not found any insights would be greatly appreciated.

library(zipcodeR)
library(tidyverse)
library(maps)
library(ggplot2)
vendavo <- read.csv("C:/Users  (ETC).

                    
                       zip_code_db <- zip_code_db %>% select(zipcode,lat,lng)
                       us<-map_data('state')
                       
#format the data (this is probably just me)
  df2 <- df2 %>%+
    mutate('GeographyLevel5' = as.numeric('GeographyLevel5')+
           mutate('zipcode' = as.numeric('zipcode'),
plot_map <- vendavo %>% 
  select(GeographyLevel5,TargetPrice,QuoteStatus) %>%
  left_join(zip_code_db,by = c("GeographyLevel5" = "zipcode"))


####
ggplot(plot_map,aes(lng,lat)) +
  geom_polygon(data=us,aes(x=long,y=lat,group=group),color='gray',fill=NA,alpha=.35)+
  geom_point(aes(color = TargetPrice),size=1,alpha=.75) +
  xlim(-125,-65)+ylim(20,50)+
  scale_color_gradient(low="green", high="red")+
  theme_bw()+
  facet_wrap(~QuoteStatus)+
  labs(x = "longitude",
       y= "Latitude",
       title = "Pricing Data")+
  theme(plot.title = element_text(hjust = 0.5))

Hi, the error would suggest that the plot_map object that you defined earlier isn't being saved. Maybe there is an error with that?

A reproducible example would be useful (we don't have your dataset).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.