Hello, I have a dataset with latitude, longitude, station serial numbers of my fish samples collected from the Barents Sea. I need to plot out from where the samples are coming from using the latitude and longitude and the range of body sizes (length of fishes) using R. I installed packages like sp, maptools, mapdata, rgdal,shape, maps. Is there any code to do this task? Please let me know. Cheers -- *Anjaly Govindankutty Menon* Erasmus Mundus Scholar Universite de Bordeaux, France [[alternative HTML version deleted]]
Hi! What kind of a map are you looking for? Google Earth, Open Street map or something else, please? Is your data in a data frame? Thanks, Erin On Sat, Apr 4, 2020 at 2:10 PM anjaly menon <anjalygmenon9 at gmail.com> wrote:> Hello, > > I have a dataset with latitude, longitude, station serial numbers of my > fish samples collected from the Barents Sea. I need to plot out from where > the samples are coming from using the latitude and longitude and the range > of body sizes (length of fishes) using R. > I installed packages like sp, maptools, mapdata, rgdal,shape, maps. Is > there any code to do this task? Please let me know. > > Cheers > > -- > *Anjaly Govindankutty Menon* > Erasmus Mundus Scholar > Universite de Bordeaux, France > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Erin Hodgess, PhD mailto: erinm.hodgess at gmail.com [[alternative HTML version deleted]]
Hi Anjaly, Here is a very simple way to plot something like this. There are many ways to do this and of course easier ways to automate the placement of the points and labels. library(maps) library(plotrix) map("world",xlim=c(13.548932,53.407331),ylim=c(70.824046,78.764113)) box() segments(20,76,25,77) points(25,77,pch=19) boxed.labels(20,76,"Kraken\nn=2\nlat=20 lon=76\nlength=10-20M") segments(40,72,51,71) points(51,71,pch=19) boxed.labels(40,72,"Herring\nn=20000\nlat=51 lon=70\nlength=15-20cm") Jim On Sun, Apr 5, 2020 at 6:10 AM anjaly menon <anjalygmenon9 at gmail.com> wrote:> > Hello, > > I have a dataset with latitude, longitude, station serial numbers of my > fish samples collected from the Barents Sea. I need to plot out from where > the samples are coming from using the latitude and longitude and the range > of body sizes (length of fishes) using R. > I installed packages like sp, maptools, mapdata, rgdal,shape, maps. Is > there any code to do this task? Please let me know. > > Cheers > > -- > *Anjaly Govindankutty Menon* > Erasmus Mundus Scholar > Universite de Bordeaux, France > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi Anjaly, I think that replacing the "geom_point" argument with "geom_text" will do what you want. Unfortunately I can't get an example to work (as usual) so I'm copying this back the the R help list in the hope that someone will provide the answer for you. Jim On Tue, Apr 7, 2020 at 7:29 PM anjaly menon <anjalygmenon9 at gmail.com> wrote:> > I'll show you the dataset with long and lat. There are 184 observations. The number of fishes collected is one per observation. > I am attaching the codes too > library(tidyverse) > library(rnaturalearth) > library(rnaturalearthdata) > library(sf) > world <- ne_countries(scale = "medium", returnclass = "sf") > geo1 <- read_csv(file = "geo1.csv") > varNumber <- geo1 %>% group_by(lat, long) %>% summarize(Number_sum = sum (Number)) > ggplot(data = world) + > geom_sf() + > xlab("Longitude") + ylab("Latitude") + > coord_sf(xlim = c(15, 37), ylim = c(69, 76), expand = FALSE) + > geom_point(data = varNumber, aes(x = long, y = lat, size = Number_sum)) > > My task is "how many fish are sampled in each location (plotting symbol sizes by number) > I am not sure whether what I did on my map is correct or not. > Could you please improve the script and make those changes? > Instead of the dots, numbers! >