How to Plot a US state in R? -


I can interview data for a particular situation across the entire US map. But I want to plot map of the state only with data (Oklahoma).

How can I do this in R? ggplot () + geom_polygon (data = all_states, AES (x = long, y = lat, group = group), color = "black", fill = "white") + gom_point ( Data = Station, AES (X = long, y = axis), color = "red",) + ggtitle ("distribution of flash flood events in Cones") + xlab ('longitude') + elab ('latitude') DPT (Station) structure (list (coop = c (340017 l, 340179 l, 340256 l, 340292 l, 340548 l, 340593 l, 340 9 08 l, 341243 l, 341504 l, 341724 l, 341828 l, 342678 l, 342912 L, 342944 l, 343497 l, 343628 l, 343821 l, 343871 l, 344055 l, 344204 l, 344235 l, 3442 98 L, 344573 l, 344766 l, 344861 l, 34563 l, 34550 9 l, 345855 l, 346130 l, 346139 l, 346278 l, 346629 l, 346638 l, 346670 l, 346926 l, 346935 l, 347012 L, 347,254 L, 348501 L, 348677 L, 34 9, 395 L, 349422 L, 34445, L), 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.5 9 14, 35.8161, 35.585, 36.0 9 42, 34.9894, 35.0567, 368589, 36.7222, 36.9031, 35.8583, 34.6097, 34.8 9/11, 35.505, 36.8833, 35.7781, 36.2283, 36.8 9 14, 36.1217, 35.4253, 35.6239, 34.7253, 36.6692, 36.2886, 35.0539, 36.1175, 35.936 9, 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.38 61, -101.2172, -97.7903, -102.965, -97.9294, -98.4572, -99.5017, -96.9767, -94.8833, -95.333 9, -99.17, -97.0586, -98.315, -96.3033, -96.025, -97.2814, -96.3472 , -97.2 9 7, -94.6264, -97.095, -94.9644, -97.9964, -98.6986, -95.2039), iglu = c (30 9.4, 420.6, 143.3, 268.2, 217.9, 751.3, 1259.7, 588.3, 451.4, 35 9 7, 17 9.2, 182.9, 37.55, 627.9, 487.7, 1008.9, 338.3, 554.7, 357.8, 474.3, 260.6, 912.9, 318.5, 1325.9, 320, 350.5, 486.2, 281.9, 245.4, 157.9, 576.1, 347.5, 370.3, 285, 19.7.2, 286.5, 254.5, 312.4, 134.1, 272.8, 25 9.1, 278, 493.2, 167.6), state = structure (C (1L, 1L, 1 L, 1L, 1L), 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L , 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1 L, 1A , 1L, 1L, 1L, 1L, 1L, 1L, 1L)., Label = "OK", class = "factor"), name = structure (1: 44, .label = C ( "ADA", "Altas IRIG RSCH STN", "Antilles", "ARDMARUR", "Bartweville Money AP", "Beaver", "Boise City 2E", "Buffalo 2 SSW", "CARNEGIE 5 NE", "CHEROKEE "," Claremer 2 NEE "," Durant "," EIID "," Erik "," Jiri "," Goodwell RSCH STN "," Gothia 5S "," Hammon 3 SSW "," Henness 4ESE "," Hondernville 2 SSE "," Hooker "," Jefferson "," Kent , "Kingfisher", "Loughton", "Mungzam", "Miker 5W", "Mimi", "MUSKOGEE", "Mutual", "NewKerk 1 NW", "OKNE", "Okema", "Oklseye WTR W. K.C. "," Paul Valley 4 WSW "," Access "," Perry "," Potu WR WKS "," Stolwatter 2 Name "(" Coop "," Late "," Long "," Aval "," Let "," Lie "," f "", "state", "name"), class = "data.frame", line.Name = c (na, -44l)) < / div>

edit ggplot , ggplot

  m = map_data ('state', region = 'Oklahoma') ggplot () + geom_polygon (data = m, aes (x = long, y = latitude, group = group), color = "black", fill = "white") + geom_point (data = station, aes (x = long, y = lat), color = "red",) + geom_text (data = station, aes (x = long, y = axis, label = name), size = 2, hjust = -0.1) + ggtitle ("distribution of flash flood incidents in Cones") + xlab ('longitude') + ylab ('latitude') + coord_fixed ()   

Enter image details here

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

Installing croogo for cakephp -

c# - Use custom conventions when persisting Rebus sagas in MongoDb -