0

I have the following data for a US state

d <- structure(list(Month = structure(c(5L, 4L, 9L, 1L, 8L, 7L, 6L, 
2L, 12L, 11L, 10L, 3L), .Label = c("01-Abr-14", "01-Ago-14", 
"01-Dez-14", "01-Fev-14", "01-Jan-14", "01-Jul-14", "01-Jun-14", 
"01-Mai-14", "01-Mar-14", "01-Nov-14", "01-Out-14", "01-Set-14"
), class = "factor"), Ada = c(0.1, 0.14, 0.25, -0.06, -0.15, 
0.3, 0.02, -0.01, 0.37, 0.08, 0.15, 0.17), Altus = c(0.06, 0.05, 
0.1, -0.17, -0.02, 0.25, -0.02, 0.08, 0, 0.02, 0.02, 0.02), Antlers = c(-0.08, 
0.02, 0.1, -0.38, -0.3, 0.27, -0.17, -0.1, 0.11, 0.11, 0.14, 
0), Ardmore = c(-0.01, 0.09, 0.18, -0.24, 0.02, 0.21, -0.13, 
-0.06, 0.18, 0.01, -0.02, 0.08), Bartlesville = c(-0.02, 0.09, 
0.2, 0.16, -0.07, 0.08, 0.01, 0.04, -0.01, 0.11, 0.11, 0.15), 
    Beaver = c(0.01, -0.02, 0.16, -0.08, -0.04, 0.07, 0.07, 0.07, 
    -0.12, 0.05, 0, 0.05), Boise.City = c(0.02, -0.05, 0.09, 
    -0.1, -0.24, 0.05, -0.01, 0.21, -0.01, -0.06, 0, 0.03), Buffalo = c(-0.04, 
    0, 0.15, -0.05, -0.15, 0.16, -0.11, 0.12, -0.2, 0.03, 0, 
    0.01), Carnegie = c(0.02, 0.06, 0.15, -0.16, 0.09, 0.24, 
    -0.03, 0.09, -0.16, 0.06, -0.01, 0), Cherokee = c(0.06, 0.1, 
    0.26, -0.1, -0.06, 0.2, 0.06, -0.06, -0.06, -0.11, 0, 0.08
    ), Claremore = c(-0.02, 0.22, 0.18, 0.12, -0.09, 0.11, 0.16, 
    0.04, 0.46, 0.16, 0.25, 0.17), Durant = c(0.06, 0.05, 0.15, 
    -0.11, -0.12, 0.35, -0.21, 0, 0.4, 0.04, 0.26, 0.09), Enid = c(0.07, 
    0.08, 0.34, 0, 0.18, 0.34, 0.11, 0.09, -0.04, 0.17, 0.13, 
    0.1), Erick = c(0.05, 0.06, 0.14, -0.15, -0.09, 0.07, -0.05, 
    0.13, 0.01, -0.02, 0.04, 0.02), Geary = c(-0.01, 0.01, 0.15, 
    -0.19, -0.09, 0.14, -0.18, 0.14, 0.02, 0.05, -0.07, 0), Goodwell = c(0, 
    -0.05, 0.08, -0.08, -0.01, 0, -0.06, 0.03, -0.12, 0.02, -0.03, 
    0), Guthrie = c(0.06, 0.13, 0.23, -0.09, 0.06, 0.31, -0.03, 
    0.05, -0.01, 0.03, 0.09, 0.11), Hammon = c(0.02, 0.03, 0.14, 
    -0.2, -0.04, 0.1, -0.1, 0.23, -0.07, 0.05, 0.03, 0.03), Hennessey = c(0.02, 
    0.09, 0.22, -0.04, 0.1, 0.22, 0.13, 0.2, 0.08, -0.01, 0.03, 
    0.07), Hobartmuni = c(-0.03, -0.02, 0.1, -0.17, -0.29, -0.08, 
    0.02, 0.04, -0.05, -0.03, 0, 0), Holdenville = c(-0.04, 0.12, 
    0.26, 0.05, -0.16, 0.23, 0.04, 0.01, 0.27, 0.13, 0.12, 0.07
    ), Hooker = c(0.03, -0.03, 0.07, -0.08, -0.17, 0.01, -0.03, 
    -0.05, -0.14, -0.02, 0, 0.04), Jefferson = c(0.04, 0.05, 
    0.29, 0.09, 0.05, 0.21, 0.11, 0.07, -0.03, 0.05, 0.09, 0.08
    ), Kenton = c(0.02, -0.06, 0.05, -0.12, -0.15, 0, 0.27, 0.17, 
    -0.01, -0.04, -0.02, -0.01), Kingfisher = c(0.05, 0.09, 0.18, 
    -0.02, 0.19, 0.21, -0.03, 0.19, 0.1, -0.01, 0.02, 0.11), 
    Lawton = c(0.03, 0.06, 0.06, -0.17, -0.39, 0.11, -0.1, 0.06, 
    0, 0.06, 0.03, 0.03), Mangum = c(0.01, 0, 0.05, -0.31, -0.27, 
    0.13, 0.01, -0.01, -0.01, 0, 0, 0.01), Meeker = c(-0.03, 
    0.14, 0.22, -0.15, -0.03, 0.34, 0.05, -0.03, 0.22, 0.14, 
    0.02, 0.06), Miami = c(-0.03, 0.03, 0.17, 0.12, 0.15, -0.11, 
    -0.15, -0.29, 0.34, 0.11, 0.25, 0.09), Muskogee = c(0.08, 
    0.12, 0.14, -0.04, 0.27, 0.16, -0.09, -0.07, 0.36, -0.02, 
    0.23, 0.14), Mutual = c(0.04, 0.05, 0.16, -0.05, 0.2, 0.16, 
    0.06, -0.04, -0.1, 0.02, 0, 0.08), Newkirk = c(-0.04, 0.06, 
    0.19, 0.13, -0.09, 0.15, 0.24, -0.01, -0.1, 0.21, 0, 0.1), 
    Okeene = c(0.09, 0.19, 0.12, 0.06, 0.02, 0.41, 0.03, 0.03, 
    0.37, 0.08, 0.13, 0.17), Okemah = c(0, 0.04, 0.2, -0.08, 
    0.04, 0.12, 0.05, 0.04, -0.01, 0.1, 0, 0.06), Okmulgee = c(0.04, 
    0.21, 0.17, -0.02, 0.01, 0.23, 0.03, 0.06, 0.17, 0, 0.29, 
    0.1), Pauls_valley = c(0.17, 0.17, 0.36, -0.02, -0.11, 0.27, 
    -0.12, 0.06, 0.27, 0.22, 0.13, 0.21), Pawhuska = c(0.05, 
    0.11, 0.3, 0.29, 0.19, 0.13, 0.2, -0.02, 0.1, 0.12, 0.2, 
    0.15), Perry = c(0.04, 0.13, 0.25, -0.15, -0.06, 0.02, 0.2, 
    -0.15, -0.05, 0, -0.04, 0.07), Poteau = c(-0.03, 0.05, 0.21, 
    -0.11, -0.01, -0.07, -0.11, -0.15, 0.37, 0.39, 0.25, 0.2), 
    Stillwater = c(0.04, 0.12, 0.16, -0.2, -0.04, 0.2, 0.1, -0.01, 
    0.02, 0, 0, 0.05), Tahlequah = c(0.09, 0.17, 0.27, -0.02, 
    0.48, 0.06, 0.28, 0.05, 0.38, 0.11, 0.4, 0.21), Waurika = c(0.07, 
    0.04, 0.16, -0.09, -0.12, 0.08, -0.22, -0.01, 0.09, 0.09, 
    -0.03, 0.02), Weatherford = c(0.03, 0.05, 0.23, -0.24, -0.06, 
    0.25, -0.11, 0.3, -0.1, 0.04, -0.03, 0.01), Webbersfalls = c(-0.04, 
    0.1, 0.16, -0.09, 0.09, -0.01, -0.25, -0.18, 0.39, 0.01, 
    0.3, 0.11)), .Names = c("Month", "Ada", "Altus", "Antlers", 
"Ardmore", "Bartlesville", "Beaver", "Boise.City", "Buffalo", 
"Carnegie", "Cherokee", "Claremore", "Durant", "Enid", "Erick", 
"Geary", "Goodwell", "Guthrie", "Hammon", "Hennessey", "Hobartmuni", 
"Holdenville", "Hooker", "Jefferson", "Kenton", "Kingfisher", 
"Lawton", "Mangum", "Meeker", "Miami", "Muskogee", "Mutual", 
"Newkirk", "Okeene", "Okemah", "Okmulgee", "Pauls_valley", "Pawhuska", 
"Perry", "Poteau", "Stillwater", "Tahlequah", "Waurika", "Weatherford", 
"Webbersfalls"), class = "data.frame", row.names = c(NA, -12L
))

coordinates for each place to map

coords <- structure(list(place = structure(c(2L, 3L, 4L, 5L, 6L, 7L, 8L, 
9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 
22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 
35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 1L, 44L), .Label = c(" Weatherford", 
"Ada", "Altus", "Antlers", "Ardmore", "Bartlesville", "Beaver", 
"Boise City", "Buffalo", "Carnegie", "Cherokee", "Claremore", 
"Durant", "Enid", "Erick", "Geary", "Goodwell", "Guthrie", "Hammon", 
"Hennessey", "Hobartmuni", "Holdenville", "Hooker", "Jefferson", 
"Kenton", "Kingfisher", "Lawton", "Mangum", "Meeker", "Miami", 
"Muskogee", "Mutual", "Newkirk", "Okeene", "Okemah", "Okmulgee", 
"Pauls_valley", "Pawhuska", "Perry", "Poteau", "Stillwater", 
"Tahlequah", "Waurika", "Webbersfalls"), class = "factor"), Lat = c(34.7864, 
34.5903, 34.2208, 34.1714, 36.7683, 36.8125, 36.7236, 36.8003, 
35.1756, 36.7747, 36.3225, 34.0003, 36.4194, 35.2164, 35.6267, 
36.5914, 35.8161, 35.585, 36.0942, 34.9894, 35.0567, 36.8589, 
36.7222, 36.9031, 35.8583, 34.6097, 34.8911, 35.505, 36.8833, 
35.7781, 36.2283, 36.8914, 36.1217, 35.4253, 35.6239, 34.7253, 
36.6692, 36.2886, 35.0539, 36.1175, 35.9369, 34.1747, 35.52, 
35.4814), Long = c(-96.685, -99.3344, -95.615, -97.1294, -96.0261, 
-100.5308, -102.4806, -99.6403, -98.5794, -98.3583, -95.5808, 
-96.3686, -97.8747, -99.8628, -98.3225, -101.6181, -97.395, -99.3953, 
-97.835, -99.0525, -96.3861, -101.2172, -97.7903, -102.965, -97.9294, 
-98.4572, -99.5017, -96.9767, -94.8833, -95.3339, -99.17, -97.0586, 
-98.315, -96.3033, -96.025, -97.2814, -96.3472, -97.2897, -94.6264, 
-97.095, -94.9644, -97.9964, -98.6986, -95.2039)), .Names = c("place", 
"Lat", "Long"), class = "data.frame", row.names = c(NA, -44L))

So basically I want to take the values, find out which one is positive and which one is negative and plot a figure like below.

  • There will be three different tickers for +,- and zero
  • 12 facets for 12 months

I have the lat/longs for the 44 places, so I can plot them on the state map.

How can I do this using ggplot2? or some other utility.

enter image description here

Till now, I have plotted the points using the following code

ggplot() + 
  geom_polygon(data=m, aes(x=long, y=lat,group=group),colour="black", fill="white" )+
  geom_point(data=stations,aes(x=long,y=lat),,colour="red",)+
  size=0.5,hjust=0,alpha=.5),size=3)+
  xlab('Longitude')+
  ylab('Latitude')+
  coord_fixed()

enter image description here

Paulo E. Cardoso
  • 5,778
  • 32
  • 42
Geekuna Matata
  • 1,349
  • 5
  • 19
  • 38
  • What have you tried? Also, which state is it and what do the column names mean (counties??)? – jlhoward Apr 25 '14 at 20:12
  • The state is Oklahoma. And the columns are particular locations for which I have coordinates. I haven't done facets before. So I am stuck how to assign the id. So stuck in the first part. I finally could plot the locations though. I have added the code – Geekuna Matata Apr 25 '14 at 20:18
  • @GeekunaMatata Where are the coordinates of the 44 places? – Paulo E. Cardoso Apr 25 '14 at 20:23

2 Answers2

3

Try this

Load lackages, download when necessary

kpacks <- c('raster', 'ggplot2', 'reshape2', 'lubridate')
new.packs <- kpacks[!(kpacks %in% installed.packages()[,"Package"])]
if(length(new.packs)) install.packages(new.packs)
lapply(kpacks, require, character.only=T)
remove(kpacks, new.packs)

d <- read.table(text=readClipboard(), sep = '\t', header=TRUE)
# or copy and paste the data from above
coords <- read.table(text=readClipboard(), sep = '\t', header=TRUE, quote = '')
# or copy and paste the data from above
#coordinates(coords) <- ~Long+Lat #not necessary for this approach

Get data from GADM

usa <- raster::getData(country = 'USA', level = 1)
okl <- usa[usa@data$NAME_1 == 'Oklahoma', ]
#plot(okl)
#plot(coords, add = T, cols = d)

d1 <- melt(d) # reshape it
d1$Month <- lubridate::dmy(d1$Month) # I've used abrev names in Portuguese. Change accordingly

create a factor variable with levels = positive/zero/negative

d1$val <- cut(d1$value, breaks= c(min(d1$value), 0.00, 0.001, max(d1$value)),
              labels = c('negative', 'zero', 'positive'),
              right = F, include.lowest = T, dig.lab = 3)

d2 <- merge(d1, coords, by.x = 'variable', by.y = 'place', all.x = T)
head(d2)
  variable Month value      val     Lat    Long
1      Ada   Jul  0.02 positive 34.7864 -96.685
2      Ada   May -0.15 negative 34.7864 -96.685
3      Ada   Jun  0.30 positive 34.7864 -96.685
4      Ada   Jan  0.10 positive 34.7864 -96.685
5      Ada   Feb  0.14 positive 34.7864 -96.685
6      Ada   Mar  0.25 positive 34.7864 -96.685

okl_df <- fortify(okl) # spdf to data.frame
head(okl_df)
       long      lat order  hole piece group id
1 -95.52363 37.00093     1 FALSE     1  36.1 36
2 -95.40672 37.00047     2 FALSE     1  36.1 36
3 -95.40027 37.00053     3 FALSE     1  36.1 36
4 -95.07227 36.99872     4 FALSE     1  36.1 36
5 -95.03362 36.99859     5 FALSE     1  36.1 36
6 -95.03309 36.99920     6 FALSE     1  36.1 36

p <- ggplot(data = okl_df, aes(x = long, y = lat, group = group)) + 
  geom_polygon(fill = NA, colour = 'black') +
  geom_point(inherit.aes = F, data = d2, aes(x=Long, y = Lat, colour = val)) + 
  facet_wrap(~ Month, ncol = 3) +
  theme_minimal() +
  coord_map()+
  scale_colour_manual('class', values = c('negative'= 'grey80', 'zero' = 'grey60',
                                          'positive' = 'black'))
p

minimal plot

EDIT

For mapping the variable to shapes instead of colours one can map it to aesthetics

p1 <- ggplot(data = okl_df, aes(x = long, y = lat, group = group)) + 
  geom_polygon(fill = NA, colour = 'black') +
  geom_point(inherit.aes = F, data = d2, aes(x=Long, y = Lat, shape = val)) + 
  facet_wrap(~ Month, ncol = 3) +
  theme_minimal() +
  coord_map()
p1

shape aesthetic

Or map both colour and shape to aesthetics

p2 <- ggplot(data = okl_df, aes(x = long, y = lat, group = group)) + 
  geom_polygon(fill = NA, colour = 'black') +
  geom_point(inherit.aes = F, data = d2, aes(x=Long, y = Lat, colour = val,
             shape = val)) + 
  facet_wrap(~ Month, ncol = 3) +
  theme_minimal() +
  coord_map()
p2

plot2 mapping two aesthetics

You can export it as png, manipulating resolution was needed

ggsave(file = file.path(tempdir(),'map1.png'),
       p
       , width=16, height=16, units = "cm", dpi = 150
)
Paulo E. Cardoso
  • 5,778
  • 32
  • 42
  • Thank you. I am testing it now. Could you also include for No Trend. i.e. for values that are zero? Also which dataset are you using (Clipboard)? – Geekuna Matata Apr 25 '14 at 21:38
  • @GeekunaMatata I'm using the data of the edited question: d and coords. I'll add the zero group. – Paulo E. Cardoso Apr 25 '14 at 21:42
  • I understand the rest of your answer. But not the importing data part. :( I'll probably use the CSV format for the same data and import it. How can I do it? – Geekuna Matata Apr 25 '14 at 21:46
  • Got it. But I have 12 warning messages of the same: Warning messages: 1: Removed 2 rows containing missing values (geom_point). Why is that? I get the figure though. – Geekuna Matata Apr 25 '14 at 22:06
  • @GeekunaMatata I don't know what you are doing, exactly doing so it is difficult to track or reproduce the reported error. – Paulo E. Cardoso Apr 25 '14 at 22:09
  • Thank you. However, since I'll be publishing it in Black and White, I would like to use different tickers instead of different colors (As shown in example). How can I do that? – Geekuna Matata Apr 25 '14 at 22:10
  • Another question: My plot is coming as a very low resolution one. I am not sure why. Before this I always got high resolution pictures. Is there a problem with the GADM data? How can I get a high-resolution figure? I am working in RSTudio. – Geekuna Matata Apr 25 '14 at 22:14
  • @GeekunaMatata you can save it with ?ggsave or?png or ?tiff, changing the resolution accordingly. – Paulo E. Cardoso Apr 25 '14 at 22:22
  • @GeekunaMatata I also get the warning of two rowns with missing value. I'm trying to figure out why. – Paulo E. Cardoso Apr 25 '14 at 22:36
  • @GeekunaMatata It would be nice to accept the best answer (not only upvoting) – Paulo E. Cardoso Apr 26 '14 at 01:45
  • Yes, will do tomorrow. I am just modifying my code right now. Incase something crops up.... – Geekuna Matata Apr 26 '14 at 04:21
  • Thank you.N however, there are still those missing points though. Could you figure out the reason? – Geekuna Matata Apr 26 '14 at 19:40
  • @GeekunaMatata simply because when merging data there is unmatches among d and coords dataframes for "Boise City" and "Weatherford". It is a naming issue only. – Paulo E. Cardoso Apr 26 '14 at 21:47
  • Thank you. All working now. Just one query: How can I use shape = factor() with this data so that I can have different cross hairs for the three categories instead of colors. – Geekuna Matata Apr 28 '14 at 21:49
  • Thank you! You are an R God. – Geekuna Matata Apr 29 '14 at 23:56
0

Add facet_wrap(~ month) or facet_grid(month ~ .) at the end of your plotting code. You can also specify the number of columns in facet_wrap: facet_wrap(~ month, ncol = 3)

I've rearranged your data:

  1. transposed the data
  2. named the first column place

The resulting dataframe:

oklahoma <- structure(list(place = structure(1:44, .Label = c("Ada", "Altus", "Antlers", "Ardmore", "Bartlesville", "Beaver", "Boise City", "Buffalo", "Carnegie", "Cherokee", "Claremore", "Durant", "Enid", "Erick", "Geary", "Goodwell", "Guthrie", "Hammon", "Hennessey", "Hobartmuni", "Holdenville", "Hooker", "Jefferson", "Kenton", "Kingfisher", "Lawton", "Mangum", "Meeker", "Miami", "Muskogee", "Mutual", "Newkirk", "Okeene", "Okemah", "Okmulgee", "Pauls valley", "Pawhuska", "Perry", "Poteau", "Stillwater", "Tahlequah", "Waurika", "Weatherford", "Webbersfalls"), class = "factor"), Jan = structure(c(16L, 12L, 5L, 1L, 2L, 7L, 8L, 4L, 8L, 12L, 2L, 12L, 16L, 11L, 1L, 6L, 12L, 8L, 8L, 3L, 4L, 9L, 10L, 8L, 11L, 9L, 7L, 3L, 3L, 14L, 10L, 4L, 15L, 6L, 10L, 17L, 11L, 10L, 3L, 10L, 15L, 13L, 9L, 4L), .Label = c("-0,01", "-0,02", "-0,03", "-0,04", "-0,08", "0", "0,01", "0,02", "0,03", "0,04", "0,05", "0,06", "0,07", "0,08", "0,09", "0,1", "0,17"), class = "factor"), Feb = structure(c(17L, 10L, 7L, 12L, 12L, 1L, 3L, 5L, 11L, 13L, 21L, 10L, 13L, 11L, 6L, 3L, 16L, 8L, 12L, 1L, 15L, 2L, 10L, 4L, 12L, 11L, 5L, 17L, 8L, 15L, 10L, 11L, 19L, 9L, 20L, 18L, 14L, 16L, 10L, 15L, 18L, 9L, 10L, 13L), .Label = c("-0,02", "-0,03", "-0,05", "-0,06", "0", "0,01", "0,02", "0,03", "0,04", "0,05", "0,06", "0,09", "0,1", "0,11", "0,12", "0,13", "0,14", "0,17", "0,19", "0,21", "0,22"), class = "factor"), Mar = structure(c(18L, 6L, 6L, 12L, 14L, 10L, 5L, 9L, 9L, 19L, 12L, 9L, 22L, 8L, 9L, 4L, 17L, 8L, 16L, 6L, 19L, 3L, 21L, 1L, 12L, 2L, 1L, 16L, 11L, 8L, 10L, 13L, 7L, 14L, 11L, 23L, 22L, 18L, 15L, 10L, 20L, 10L, 17L, 10L), .Label = c("0,05", "0,06", "0,07", "0,08", "0,09", "0,1", "0,12", "0,14", "0,15", "0,16", "0,17", "0,18", "0,19", "0,2", "0,21", "0,22", "0,23", "0,25", "0,26", "0,27", "0,29", "0,3", "0,36"), class = "factor"), Apr = structure(c(4L, 14L, 17L, 15L, 24L, 5L, 7L, 3L, 11L, 7L, 22L, 8L, 18L, 14L, 13L, 5L, 6L, 14L, 2L, 12L, 19L, 5L, 21L, 9L, 1L, 12L, 16L, 10L, 22L, 2L, 3L, 23L, 20L, 5L, 1L, 1L, 25L, 14L, 8L, 14L, 1L, 6L, 15L, 6L), .Label = c("-0,02", "-0,04", "-0,05", "-0,06", "-0,08", "-0,09", "-0,1", "-0,11", "-0,12", "-0,15", "-0,16", "-0,17", "-0,19", "-0,2", "-0,24", "-0,31", "-0,38", "0", "0,05", "0,06", "0,09", "0,12", "0,13", "0,16", "0,29"), class = "factor"), May = structure(c(10L, 18L, 16L, 20L, 5L, 3L, 13L, 10L, 24L, 4L, 6L, 9L, 28L, 7L, 6L, 1L, 23L, 3L, 25L, 15L, 11L, 12L, 22L, 10L, 27L, 17L, 14L, 2L, 26L, 29L, 28L, 6L, 20L, 21L, 19L, 8L, 27L, 7L, 1L, 3L, 30L, 9L, 4L, 24L), .Label = c("-0,01", "-0,03", "-0,04", "-0,06", "-0,07", "-0,09", "-0,1", "-0,11", "-0,12", "-0,15", "-0,16", "-0,17", "-0,24", "-0,27", "-0,29", "-0,3", "-0,39", "0", "0,01", "0,02", "0,04", "0,05", "0,06", "0,09", "0,1", "0,15", "0,19", "0,2", "0,27", "0,48"), class = "factor"), Jun = structure(c(26L, 24L, 25L, 20L, 11L, 10L, 8L, 18L, 23L, 19L, 13L, 29L, 26L, 10L, 16L, 5L, 27L, 12L, 21L, 3L, 22L, 6L, 20L, 5L, 20L, 13L, 15L, 28L, 4L, 18L, 18L, 17L, 30L, 14L, 22L, 25L, 15L, 7L, 2L, 19L, 9L, 11L, 24L, 1L), .Label = c("-0,01", "-0,07", "-0,08", "-0,11", "0", "0,01", "0,02", "0,05", "0,06", "0,07", "0,08", "0,1", "0,11", "0,12", "0,13", "0,14", "0,15", "0,16", "0,2", "0,21", "0,22", "0,23", "0,24", "0,25", "0,27", "0,3", "0,31", "0,34", "0,35", "0,41"), class = "factor"), Jul = structure(c(17L, 15L, 10L, 8L, 16L, 22L, 1L, 6L, 2L, 21L, 26L, 12L, 23L, 5L, 11L, 3L, 2L, 5L, 25L, 17L, 19L, 2L, 24L, 29L, 2L, 5L, 16L, 20L, 9L, 4L, 21L, 28L, 18L, 20L, 18L, 7L, 27L, 27L, 6L, 23L, 30L, 13L, 6L, 14L), .Label = c("-0,01", "-0,03", "-0,06", "-0,09", "-0,1", "-0,11", "-0,12", "-0,13",     "-0,15", "-0,17", "-0,18", "-0,21", "-0,22", "-0,25", "0", "0,01", "0,02", "0,03", "0,04", "0,05", "0,06", "0,07", "0,1", "0,11", "0,13", "0,16", "0,2", "0,24", "0,27", "0,28"), class = "factor"),     Aug = structure(c(1L, 20L, 8L, 6L, 16L, 19L, 29L, 23L, 21L, 6L, 16L, 13L, 22L, 24L, 25L, 15L, 17L, 30L, 28L, 16L, 14L, 5L, 19L, 26L, 27L, 18L, 1L, 3L, 12L, 7L, 4L, 1L, 15L, 16L, 18L, 18L, 2L, 11L, 9L, 1L, 17L, 1L, 31L, 10L), .Label = c("-0,01", "-0,02", "-0,03", "-0,04", "-0,05", "-0,06", "-0,07", "-0,1", "-0,15", "-0,18", "-0,2", "-0,29", "0", "0,01", "0,03", "0,04", "0,05", "0,06", "0,07", "0,08", "0,09", "0,1", "0,12", "0,13", "0,14", "0,17", "0,19", "0,2", "0,21", "0,23", "0,3"), class = "factor"), Sep = structure(c(24L, 11L, 17L, 19L, 1L, 7L, 1L, 10L, 9L, 4L, 28L, 27L, 11L, 12L, 13L, 7L, 1L, 5L, 14L, 3L, 21L, 8L, 2L, 1L, 16L, 11L, 1L, 20L, 22L, 23L, 6L, 6L, 24L, 1L, 18L, 21L, 16L, 6L, 24L, 13L, 25L, 15L, 6L, 26L), .Label = c("-0,01", "-0,03", "-0,05", "-0,06", "-0,07", "-0,1", "-0,12", "-0,14", "-0,16", "-0,2", "0", "0,01", "0,02", "0,08", "0,09", "0,1", "0,11", "0,17", "0,18", "0,22", "0,27", "0,34", "0,36", "0,37", "0,38", "0,39", "0,4", "0,46"), class = "factor"), Oct = structure(c(14L, 9L, 17L, 8L, 17L, 12L, 5L, 10L, 13L, 6L, 21L, 11L, 22L, 7L, 12L, 9L, 10L, 12L, 1L, 3L, 19L, 2L, 12L, 4L, 1L, 13L, 7L, 20L, 17L, 2L, 9L, 23L, 14L, 16L, 7L, 24L, 18L, 7L, 25L, 7L, 17L, 15L, 11L, 8L), .Label = c("-0,01", "-0,02", "-0,03", "-0,04", "-0,06", "-0,11", "0", "0,01", "0,02", "0,03", "0,04", "0,05", "0,06", "0,08", "0,09", "0,1", "0,11", "0,12", "0,13", "0,14", "0,16", "0,2", "0,21", "0,22", "0,39"), class = "factor"), Nov = structure(c(15L, 6L, 14L, 2L, 11L, 5L, 5L, 5L, 1L,  5L, 18L, 19L, 10L, 8L, 4L, 3L, 9L, 7L, 7L, 5L, 12L, 5L, 9L, 2L, 6L, 7L, 5L, 6L, 18L, 17L, 5L, 5L, 13L, 5L, 20L, 13L, 16L, 5L, 18L, 5L, 22L, 3L, 3L, 21L), .Label = c("-0,01", "-0,02", "-0,03", "-0,07", "0", "0,02", "0,03", "0,04", "0,09", "0,1", "0,11", "0,12", "0,13", "0,14", "0,15", "0,2", "0,23",    "0,25", "0,26", "0,29", "0,3", "0,4"), class = "factor"), Dec = structure(c(16L, 4L, 2L, 10L, 15L, 7L, 5L, 3L, 2L, 10L, 16L, 11L, 12L, 4L, 2L, 2L, 13L, 5L, 9L, 2L, 9L, 6L, 10L, 1L, 13L, 5L, 3L, 8L, 11L, 14L, 10L, 12L, 16L, 8L, 12L, 18L, 15L, 9L, 17L, 7L, 18L, 4L, 3L, 13L), .Label = c("-0,01", "0", "0,01", "0,02", "0,03", "0,04", "0,05", "0,06", "0,07", "0,08", "0,09", "0,1", "0,11", "0,14", "0,15", "0,17", "0,2", "0,21"), class = "factor"), Lat = structure(c(8L, 5L, 4L, 2L, 37L, 40L, 36L, 39L, 13L, 38L, 32L, 1L, 26L, 14L, 21L, 33L, 23L, 19L, 27L, 10L, 12L, 41L, 35L, 44L, 24L, 6L, 9L, 17L, 42L, 22L, 30L, 43L, 29L, 15L, 20L, 7L, 34L, 31L, 11L, 28L, 25L, 3L, 18L, 16L), .Label = c("34", "34,1714", "34,1747", "34,221", "34,6", "34,61", "34,7253", "34,786", "34,8911", "34,9894", "35,054", "35,0567", "35,1756", "35,2", "35,4253", "35,4814", "35,505", "35,52", "35,585", "35,6239", "35,63", "35,7781", "35,816", "35,8583", "35,9369", "36", "36,0942", "36,1175", "36,122", "36,228", "36,3", "36,3225", "36,5914", "36,6692", "36,7222", "36,7236", "36,7683", "36,7747", "36,8", "36,813", "36,859", "36,88", "36,8914", "36,903"), class = "factor"), Long = structure(c(20L, 39L, 13L, 25L, 15L, 2L, 5L, 44L, 37L, 35L, 12L, 18L, 32L, 1L, 33L, 4L, 27L, 42L, 29L, 40L, 19L, 3L, 28L, 6L, 30L, 36L, 43L, 21L, 8L, 11L, 41L, 23L, 34L, 16L, 14L, 26L, 17L, 22L, 7L, 24L, 9L, 31L, 38L, 10L), .Label = c("-100", "-100,5", "-101,2", "-101,618", "-102,481", "-103", "-94,63", "-94,9", "-94,9644", "-95,2039", "-95,3339", "-95,5808", "-95,62", "-96,025", "-96,0261", "-96,303", "-96,3472", "-96,37", "-96,3861", "-96,69", "-96,98", "-97", "-97,059", "-97,095", "-97,129", "-97,2814", "-97,4", "-97,7903", "-97,835", "-97,9294", "-97,996", "-98", "-98,3", "-98,32", "-98,3583", "-98,46", "-98,579", "-98,6986", "-99", "-99,0525", "-99,17", "-99,3953", "-99,502", "-99,64"), class = "factor")), .Names = c("place", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Lat", "Long"), class = "data.frame", row.names = c(NA, -44L))

After that reshape the dataframe:

require(reshape2)
stations <- melt(oklahoma, id=c("place","Lat","Long"))
stations$value <- gsub(',', '.', stations$value)
stations$value <- as.numeric(stations$value)

The create the plot:

ggplot() + 
  # geom_polygon(data=m, aes(x=Long, y=Lat,group=group), colour="black", fill="white") +
  geom_point(data=stations, aes(x=Long,y=Lat), colour="red")+
  xlab('Longitude') +
  ylab('Latitude') +
  coord_fixed() +
  facet_wrap(~ variable, ncol = 3)

As you can see, I commented out the geom_polygon as I don't have that data.

Jaap
  • 81,064
  • 34
  • 182
  • 193
  • Have you tested this? I think you would need a `month` column in both the `stations` data frame *and* the `m` data frame (which has the map coordinates). That makes it much more complicated. – jlhoward Apr 25 '14 at 20:29
  • Could you please check the data again. I have added the lat-long info now. Thank you for your help. – Geekuna Matata Apr 25 '14 at 20:30
  • I have added the data in another format if you want it this way: http://1drv.ms/1pzCcCg – Geekuna Matata Apr 25 '14 at 20:37
  • See my updated answer, could you also provide the data of `m` which is needed for plotting `geom_polygon`? – Jaap Apr 25 '14 at 21:13