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 anj
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
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 wrote:
> Hello,
>
> I have a dataset with latitude, longitude, station serial numbers of my
> fish samp
This should help you get started:
library(maptools)
library(ggplot2)
library(ggalt)
library(ggthemes)
library(tibble)
library(viridis)
# get italy region map
italy_map <- map_data("italy")
# your data will need to have these region names
print(unique(italy_map$region))
# w
Miluji Sb gmail.com> writes:
>
> Dear all.
>
> I would like to draw a map of France, Italy, Spain, and Portugal at NUTS 2
> level. I used the following code:
>
...
> # Subset NUTS 2 level data
> map_nuts2 <- subset(EU_NUTS, STAT_LEVL_ == 2)
>
> # Draw basic plot
> plot(map_nuts2)
country <-
Using dput() to provide your data is enormously easier.
Assuming the original column names of your data frame correspond to
the ColMap column of the second data frame, it's very straightforward:
mat <- structure(list(A = c(0.01, -2, -4), B = c(0.2, 1.4, -3), C = c(-0.3,
2.3, -2), D = c(0.8, 3.1,
Fantastic Jim! Thanks a lot
Julien
___
Julien Million
Independent Fisheries Consultant
On 30/07/14 11:31, "Jim Lemon" wrote:
>On Wed, 30 Jul 2014 11:18:13 AM Julien Million wrote:
>> Hi,
>>
>> I would like to plot a map without political borders, but not black... I
>>
On Wed, 30 Jul 2014 11:18:13 AM Julien Million wrote:
> Hi,
>
> I would like to plot a map without political borders, but not black... I
> am mainly using the maps package, and wanted to know if it was
possible
> with this one, or if I should use something else, like shape file.
>
> If I do
>
>
Here is an example using the subplot function.
library(TeachingDemos)
map("state", region= "ohio", xlim=c(-85, -80), ylim=c(38, 42))
tmp <- subplot(map("state",add=TRUE), 'bottomright', type='fig',
size=c(0.2,0.2), inset=0.1)
op <- par(fig=tmp$fig)
map("state", region="ohio", fill=T, add=T)
par(op
Please don't post HTML email.. we don't necessarily see what you see when you
do that. Read the Posting Guide for more list etiquette.
Have you played with the "usr" coordinates? Have you read the help for the par
function?
The par(usr=...) call is telling base graphics what the x and y coordin
On 03/01/2014 01:53 AM, Ciara O'Hara wrote:
Hi everyone,
I am using the script below to create a map plot of Ireland.
library(ncdf)library(maps)library(mapdata)library(maptools)library(RColorBrewer)shapefile<-readShapeLines("C:\\Users\\sophysics\\Desktop\\IRL_adm\\IRL_adm1.shp")file<-open.ncdf("C
On 01/03/14 03:53, Ciara O'Hara wrote:
> Hi everyone,
> I am using the script below to create a map plot of Ireland.
> library(ncdf)library(maps)library(mapdata)library(maptools)library(RColorBrewer)shapefile<-readShapeLines("C:\\Users\\sophysics\\Desktop\\IRL_adm\\IRL_adm1.shp")file<-open.ncdf("C
Hi David,
That worked brilliantly! Many thanks. I also had trouble getting subplot()
to work with either TeachingDemos or Hmisc.
Best,
Mark
--
View this message in context:
http://r.789695.n4.nabble.com/map-with-inset-tp4678341p4678426.html
Sent from the R help mailing list archive at Nabble.
help-boun...@r-project.org] On Behalf Of Bert Gunter
Sent: Wednesday, October 16, 2013 11:54 AM
To: David Winsemius
Cc: r-help@r-project.org; markw
Subject: Re: [R] map with inset
... and if that doesn't do it, check out the CRAN "spatial" task
view, The
"maptools" package or others
... and if that doesn't do it, check out the CRAN "spatial" task view, The
"maptools" package or others might have what you need with a friendlier
interface.
Cheers,
Bert
On Wed, Oct 16, 2013 at 9:39 AM, David Winsemius wrote:
>
> On Oct 16, 2013, at 3:47 AM, markw wrote:
>
> > Hi,
> >
> > I a
On Oct 16, 2013, at 3:47 AM, markw wrote:
> Hi,
>
> I am trying to put an inset of North America onto a finer-scale map and
> cannot seem to get the two maps on the same plot.
>
> the main map is:
> map("worldHires", c("Canada", "USA"), xlim=c(-75, -52), ylim=c(40, 55),
> col="gray90", fill=TR
Hi,
There is a problem with xlim and ylim.
map("worldHires","Antarctica",xlim=c(-180,180),ylim=c(-90,-60),col="gray90",fill=TRUE)
You also might have a look at "ggplot2"
library(ggplot2)
world <- map_data("world")
worldmap <- ggplot(world, aes(x=long, y=lat, group=group)) +
geom_path() +
You have mixed your x with your y, try this:
map("worldHires","Antarctica",ylim=c(-90,-60),xlim=c(-180,180),col="gray90",fill=TRUE)
I tend not to use maps/mapdata if I can help it (there are problems as
you can see, though there is support for projections with mapproject,
see ?map), if you want
un2(vec4))
#[1] FALSE
vec5
#[1] "Iphone 4S 16G"
identical(fun2(vec6),fun2(vec7))
#[1] TRUE
A.K.
From: Tammy Ma
To: smartpink...@yahoo.com; "r-help@r-project.org"
Sent: Thursday, November 8, 2012 8:12 AM
Subject: Re: [R] map two name
t;
fun1(vec6)
#[1] "5830aceGlaxyS"
identical(fun1(vec6),fun1(vec7))
#[1] TRUE
identical(fun1(vec5),fun1(vec1))
#[1] TRUE
identical(fun1(vec1),fun1(vec4))
#[1] FALSE
A.K.
From: Tammy Ma
To: smartpink...@yahoo.com; "r-help@r-project.org"
Sent:
ec4)
#[1] "16_3S_G_Iphone"
fun1(vec5)
#[1] "16_4S_G_Iphone"
identical(fun1(vec1),fun1(vec5))
#[1] TRUE
identical(fun1(vec1),fun1(vec4))
#[1] FALSE
A.K.
From: Tammy Ma
To: smartpink...@yahoo.com; "r-help@r-project.org"
Sent: Thursday, November 8, 2012 8:12 AM
S
not sure what the problem is. It works with this example. If you can
provide some details, then it would be more helpful.
A.K.
____________
From: Tammy Ma
To: smartpink...@yahoo.com; "r-help@r-project.org"
Sent: Thursday, November 8, 2012 8:12 AM
Subject: Re: [
;-paste(sort(unlist(strsplit(vec4," "))),collapse= "_")
res11<-paste(sort(unlist(strsplit(vec4," "))),collapse= "_")
identical(res11,res33)
#[1] FALSE
identical(res11,res44)
#[1] TRUE
A.K.
From: Tammy Ma
To: smartp
Thanks.
Yes. Your approach can identify:
Glaxy ace S 5830 and
S 5830 Glaxy ace
But you can not identify using same program:
Iphone 4S 16 G
Iphone 4S 16G
How should I solve both in same time.
Kind regards,Tammy
[[alternative
HI,
Try this:
vec1<-"GALAXY ACE S 5830"
vec2<-"S 5830 GALAXY ACE"
vec3<-"R GALAXY 5812 ACE"
vec11<-paste(sort(unlist(strsplit(vec2," "))),collapse="_")
vec22<-paste(sort(unlist(strsplit(vec2," "))),collapse="_")
vec11
#[1] "5830_ACE_GALAXY_S"
vec22
#[1] "5830_ACE_GALAXY_S"
identical(vec11,
Hi Tammy,
I think we need more information.
Are the names always four parts?
Does the fix always involve moving two parts from the back to the front?
For that matter, which of the two you gave is correct?
Or does it matter what order the parts are in as long as it's consistent?
Sorting them would
It may be easy or difficult depending on what your data are like.
"GALAXY ACE S 5830" vs "S 5830 GALAXY ACE"
One easy and reasonably general way would be to divide each such bit
into 4 "words" and then compare if set 2 contains exactly all words in
set 1 but possibly in different order.
x1 <- "G
There is no particular requirement to start with decimal degrees in R.
You could have started with their original projection, as loaded into R,
and reprojected directly to your desired projection (i.e., without the
extra step of passing them through ArcGIS).
By the way, this would have been a goo
Since posting this I've figured out the problem was due to the shapefiles I
was reading in. As they were already projected they were in meters, as
oppose to decimal degrees. By opening the shapefiles in ArcGIS, reprojecting
them to WGS1984 and exporting, I could then reload them in R in decimal
deg
Thanks you very much for your time Michael, and I have noted that this should
have been asked at the R-Sig-Geo site
cheers!
Michael Sumner-2 wrote
>
> Sorry I take that back, I was using the (independent of GDAL)
> shapefile reader in maptools. Using the rgdal package, we get the full
> projecti
Sorry I take that back, I was using the (independent of GDAL)
shapefile reader in maptools. Using the rgdal package, we get the full
projection information from the auxiliary .xml file that ships with
the other shapefile files.
library(rgdal)
## Here my working directory "." contains "NA_CEC_Eco_
There is no coordinate system defined for these files- proj4string is
NA, see below - otherwise transforming them to that used by the maps
package is trivial. I suggest you find out the coordinate system from
the provider of the data and ask any further questions on R-Sig-Geo.
This is a big file, ~
Try the R-Sig-Geo mailing list for a better target community, but if these
are shapefiles there is read support in rgdal (or maptools for a simpler
alternative) and if these are in long-lat like the maps package then
plot(x, add=TRUE) will be most of the way there.
If you need to transform either
[mailto:r-help-boun...@r-project.org] On
Behalf Of bby2...@columbia.edu
Sent: Wednesday, December 07, 2011 9:14 PM
To: David Winsemius
Cc: r-help@r-project.org
Subject: Re: [R] map at fips level using multiple variables
Hi David,
Sorry it sounds vague.
Here is my current code, which gives the
since each county gets a single color, you would need to combine two
color schemes. I am skeptical that this will work well, but you could
try using rgb(). For example - code one variable using the red
component, the other using the blue component.
albyn
On Wed, Dec 07, 2011 at 11:14:27PM -0500
Hi David,
Sorry it sounds vague.
Here is my current code, which gives the distribution of family size
at US county level. You will see on a US map family size distribution
represented by different colors.
Now if i have another variable income, which has 3 categories(<50k,
50k-80k,>80k).
On Dec 7, 2011, at 6:12 PM, bby2...@columbia.edu wrote:
Hi, I just started playing with county FIPS feature in maps package
which allows geospatial visualization of variables on US county
level. Pretty cool.
Got code?
I did some search but couldn't find answer to this question--how can
maybe this helps:
http://r.789695.n4.nabble.com/Create-a-map-td3689877.html#a3893581
--
View this message in context:
http://r.789695.n4.nabble.com/map-question-tp795873p3893593.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-
i responded offline the first time, but:
google is your friend: search for R maps and you'll find what I mention
below.
In the future make sure to perform a thorough search of google and the help
forums before you post
That said... you're looking for the maps package
install.packages('maps')
Adding to the previous question, I would like to map central Asia along with
those five countries (Kazakhstan, Kyrgyzstan, Uzbekstan, Tajikstan and
Turkmenstan). Please tell us the right data base!!! Thanks a lot!!!
--
View this message in context:
http://r.789695.n4.nabble.com/map-tp3810363p3810
Hi,
I have a MAP datafile with SNP data and would like to open it and run say
fisher's exact test and save the p-values. Anyone has any idea how this can
be done?
--
Thanks,
Jim.
[[alternative HTML version deleted]]
__
R-help@r-project.org ma
Hi
On 1/12/2010 4:44 a.m., Peter Ehlers wrote:
On 2010-11-30 04:56, Ben Tupper wrote:
Hi,
I thought it might help if I posted the resulting images.
This is the pdf file where the map polygons are not clipped to the
plotting boundary.
http://dl.dropbox.com/u/8433654/test-map.pdf
And this is
On Nov 30, 2010, at 10:44 AM, Peter Ehlers wrote:
On 2010-11-30 04:56, Ben Tupper wrote:
Hi,
I thought it might help if I posted the resulting images.
This is the pdf file where the map polygons are not clipped to the
plotting boundary.
http://dl.dropbox.com/u/8433654/test-map.pdf
And this
On 2010-11-30 04:56, Ben Tupper wrote:
Hi,
I thought it might help if I posted the resulting images.
This is the pdf file where the map polygons are not clipped to the
plotting boundary.
http://dl.dropbox.com/u/8433654/test-map.pdf
And this is the png file showing the same polygons clipped to
Hi,
I thought it might help if I posted the resulting images.
This is the pdf file where the map polygons are not clipped to the
plotting boundary.
http://dl.dropbox.com/u/8433654/test-map.pdf
And this is the png file showing the same polygons clipped to the
plotting boundary which is wha
Wolfgang Polasek gmail.com> writes:
>how to find a function for plotting polygon surface, like
> polgon3d(xc,yc,obs)
>
> xc, yc ... coordinates
> obs observations
> result: persp plot with grid net over the coordinates
Don't know of an off-the-shelf solution. Generate a Delaunay tria
On Sat, 7 Nov 2009, hadley wickham wrote:
If readShapePoly() (deprecated - use readShapeSpatial() instead) says that
the data are not polygons, then they are not. If you want to fill
administrative boundaries polygons, you need polygons, not lines. The source
you are using is based on OpenStreet
> If readShapePoly() (deprecated - use readShapeSpatial() instead) says that
> the data are not polygons, then they are not. If you want to fill
> administrative boundaries polygons, you need polygons, not lines. The source
> you are using is based on OpenStreetMaps, so more likely to be lines, and
Perhaps asking on R-sig-geo might help (as well as reading the function help
files, scripts found lying around somewhere may be stale ...)?
If readShapePoly() (deprecated - use readShapeSpatial() instead) says that
the data are not polygons, then they are not. If you want to fill
administrative b
Hi Greg
I downloaded the file "france.shapefiles.zip"
Then i unziped it.
There were 4 files interesting me:
- france_administrative.dbf
- france_administrative.prj
- france_administrative.shp
- france_administrative.shx
How can i do to read the map "france_administrative" with R
I tried this s
If your csv file has points, you can read into a data.frame using
df <- read.csv()
in the usual way (watch the decimal sign and use read.csv2() if need be),
and coerce to a SpatialPointsDataFrame by saying
coordinates(df) <- c("long", "lat")
where "long", "lat" are the names of the data.fra
Thanks a million Roger! This works well. All I now need to do is to figure
how I can plot data from a csv file onto the map. I really appreciate your
assistance!
Regards,
Raoul
Roger Bivand wrote:
>
> The illustration you show is for the so-called traditional or historical
> counties of England
Hello.
shapefiles in geographic coordinates for Epi Info
http://www.cdc.gov/epiinfo/europe.htm second-level at
1998, free available but not public domain
Regards.
--- Roger Bivand wrote:
>
> The illustration you show is for the so-called
> traditional or historical
> counties of Engla
The illustration you show is for the so-called traditional or historical
counties of England, which may be available somewhere. There are
non-georeferenced PNG files on Wikipedia, which might be used, but as far as
I can see, only UK-based academics can register for access to the edina UK
borders
Thank you for your reply. Your suggestion for sending this to another
list is probably the right one. I have just had so much wonderful
help on this one I thought I would try this one first. I am very new
to GIS and have a couple of years of experience with R. I will
probably join the sig-geo g
Wouldn't grass-users, or maybe R-sig-geo be a more appropriate list? Given
points in geographical coordinates, use project() or spTransform() in rgdal.
The former will not do datum transformation, the latter will. NAD83 is a US
datum specification based on WGS84, UTM is a projection but is useless
Ray Brownrigg ecs.vuw.ac.nz> writes:
>
> Sorry, can't be done at the moment with the maps package.
>
...
>
> You *might* be able to achieve what you want by selecting only those line
segments that
> provide portions of the external border, but I would suggest that other
packages (perhaps
> s
Sorry, can't be done at the moment with the maps package.
The "china" map database is based on data which was provided in
latitude/longitude
rectangles, and has not been properly processed to generate the line segments
and
polygons that the maps package uses to choose individual provinces or t
Thanks Ray
On Thu, Mar 12, 2009 at 11:01 PM, Dr. Alireza Zolfaghari <
ali.zolfagh...@gmail.com> wrote:
> Hi list,
> I have a real problem with plotting US state map. When I try to plot the
> northern state, there will be some blank space in the top of graph (see case
> 1 example), and when I plot
OK, the underlying problem is that the projection code (i.e. the mapproj package plus some
parts of the maps package) does not clip its output to the specified limits.
Let me explain:
1) the maps databases are made up of line segments which are combined to form
polygons
2) when you call map() w
I think what you are missing is that the default map database is "world".
If you use:
library(maps)
require("mapproj")
longlatLimit<-c(-107,-93,40,52)
par(plt=c(0,1,0,1),cex=1,cex.main=1) #Set plotting parameters
map(regions="USA", projection="azequalarea",
type="n",xlim=long
It's not clear exactly what you want, but try something like:
library(maps)
map("world", xlim=c(35, 100), ylim=c(-5, 35), interior=FALSE)
lat= c(-5,0,5,10)
long=c(35,40,45,50)
points(long, lat, col=2)
HTH,
Ray Brownrigg
On Tue, 04 Nov 2008, Yogesh Tiwari wrote:
> Hello,
> I want to crate a bla
Jacqueline Hall wrote:
Dear R helpers,
I have a 3D scatter plot that I have generated from scatterplot3d (which
looks great- thanks!) and I can see that the points in my graph fall in a
plane.
Following the example 5 from 3D scatter plot (below) I have fitted a
regression plane.
Now what I wou
Jacqueline Hall googlemail.com> writes:
> I have a 3D scatter plot that I have generated from scatterplot3d (which
> looks great- thanks!) and I can see that the points in my graph fall in a
>
> Is there a package/function that can help me do this that I have missed? or
> does anyone have any su
Werner Wernersen yahoo.de> writes:
>
> Hi,
>
> I thought about this but programming it seems rather difficult so I was
> wondering if a function exists for
> this in R (as most of the times it turns out that it does):
> I have a map (shapefile) and for about 50 points on that map (GPS location
Check your tectonic plates. You may have been using predict() to get those
figures.
--- On Fri, 8/15/08, John P. Burkett <[EMAIL PROTECTED]> wrote:
> From: John P. Burkett <[EMAIL PROTECTED]>
> Subject: Re: [R] map("state" ...) Is the USA cracking up?
> To:
The problem was solved by specifying resolution=0 in the map() function.
Would that saving the union had always been so easy and bloodless.
-John
John P. Burkett wrote:
Running R version 2.6.1 under Linux, I'm trying to use the maps and
mapdata packages and the state database to produce a themat
On Fri, 16 Nov 2007, Tom Minka wrote:
> I haven't seen the original code, but the problem with Ray's code is that
> the two projections are not synchronized. Specifically, they are using
> different (default) values for the orientation. To synchronize the
> projections, either specify the orienta
L PROTECTED]
> Sent: 14 November 2007 21:03
> To: Amandine Chevalier
> Cc: r-help@r-project.org; [EMAIL PROTECTED]
> Subject: Re: [R] map - mapproj : problem of states localisation
>
> On Wed, 14 Nov 2007, Amandine Chevalier wrote:
> > Thank you very much for your help,
&g
On Wed, 14 Nov 2007, Amandine Chevalier wrote:
> Thank you very much for your help,
>
> I work about my code so as to give you the example (attached file) :
>
> In the first case (azequalarea projection), france from the "france" map
> and from the "world" map are well superimposed, whereas in the
Unfortunately, your code is not self-contained.
Please provide a completely self-contained set of commands which illustrate
the problem (as described in the posting guide).
If you mean a problem that the boundaries don't quite line up, as illustrated
by:
map("france")
map("world", col=2, add=T)
Dear Alexander,
You can use the function readShapePoly function from maptools. This
directly reads the shapefile into a SpatialPolygons object. You also
need to install the sp package (don't know if you did that already).
You could consider joining the r-sig-geo mailing list. These kinds of
qu
72 matches
Mail list logo