Re: [R] Steps to create spatial plots

2018-01-16 Thread lily li
Hi Eric,

Thanks, it works. If I want to convert the matrix to the 1-D vector for the
levelplot, should I use the command below? I thought the t() is a reverse
function, but may be not.

values <- layer$z
values.v <- as.vector(t(values))

On Tue, Jan 16, 2018 at 12:36 AM, Eric Berger  wrote:

> If layer$z is a matrix and you want to reverse the order of the rows, you
> can do:
>
> n <- nrow(layer$z)
> layer$z <- layer$z[ n:1, ]
>
> HTH,
> Eric
>
>
> On Tue, Jan 16, 2018 at 8:43 AM, lily li  wrote:
>
>> Sorry for the emails, I just wanted to have an example.
>> layer$z
>>
>> 1  1  3  4  6  2
>> 2  3  4  1  2  9
>> 1  4  5  2  1  8
>>
>> How to convert the matrix to layer$z = c(1, 4, 5, 2, 1, 8, 2, 3, 4, 1, 2,
>> 9, 1, 1, 3, 4, 6, 2)?
>> I think this vector is the order that levelplot can use. Thanks again.
>>
>>
>> On Mon, Jan 15, 2018 at 10:58 PM, lily li  wrote:
>>
>> > Hi Bert,
>> >
>> > I think you are correct that I can use levelplot, but I have a question
>> > about converting data. For example, the statement:
>> > levelplot(Z~X*Y), Z is row-wise from the lower left corner to the upper
>> > right corner.
>> > My dataset just have gridded Z data as a txt file (or can be called
>> > matrix?), how to convert them to the vector in order for levelplot to
>> use?
>> > Thanks.
>> >
>> > On Mon, Jan 15, 2018 at 6:04 PM, Bert Gunter 
>> > wrote:
>> >
>> >> From your description, I am **guessing** that you may not want a
>> "spatial
>> >> map" (including projections) at all, but rather something like a level
>> >> plot. See ?levelplot in the lattice package for details. Both I am sure
>> >> ggplot2 has something similar.
>> >>
>> >> Apologies if I havemisunderstood your intent/specifications.
>> >>
>> >> Cheers,
>> >> Bert
>> >>
>> >>
>> >> Bert Gunter
>> >>
>> >> "The trouble with having an open mind is that people keep coming along
>> >> and sticking things into it."
>> >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>> >>
>> >> On Mon, Jan 15, 2018 at 4:54 PM, lily li  wrote:
>> >>
>> >>> Hi Roman,
>> >>>
>> >>> Thanks for your reply. For the spatial coordinates layer, I just have
>> >>> coordinates of the upper left corner, numbers of rows and columns of
>> the
>> >>> spatial map, and grid cell size. How to create a spatial layer of
>> >>> coordinates from this data? Thanks.
>> >>>
>> >>>
>> >>> On Mon, Jan 15, 2018 at 3:26 PM, Roman Luštrik <
>> roman.lust...@gmail.com>
>> >>> wrote:
>> >>>
>> >>> > You will need to coerce your data into a "spatial" kind, as
>> >>> implemented in
>> >>> > `sp` or as of late, `sf` packages. You might want to give the
>> >>> vignettes a
>> >>> > whirl before you proceed.
>> >>> > Roughly, you will have to coerce the data to Spatial* (you could go
>> >>> for a
>> >>> > point, raster or grid type, I think) and also specify the
>> projection.
>> >>> Once
>> >>> > you have that, plotting should be handled by packages.
>> >>> >
>> >>> > Here are a few quick links that might come handy:
>> >>> >
>> >>> > https://cran.r-project.org/web/views/Spatial.html
>> >>> > http://www.datacarpentry.org/R-spatial-raster-vector-
>> >>> > lesson/10-vector-csv-to-shapefile-in-r/
>> >>> >
>> >>> >
>> >>> > Cheers,
>> >>> > Roman
>> >>> >
>> >>> > On Mon, Jan 15, 2018 at 11:22 PM, lily li 
>> wrote:
>> >>> >
>> >>> >> Hi users,
>> >>> >>
>> >>> >> I have no clear clue about plotting spatial data. For example, I
>> just
>> >>> >> have a table with attribute values of each grid cell, such as
>> >>> elevation.
>> >>> >> Then I have coordinates of the upper left corner in UTM, the number
>> >>> of rows
>> >>> >> and columns, and grid cell size. How to create spatial plot of
>> >>> elevations
>> >>> >> for the grid cells, in color ramp? Should I create a spatial grid
>> >>> layer
>> >>> >> with all the polygons first? Thanks.
>> >>> >>
>> >>> >> --
>> >>> >> --
>> >>> >> You received this message because you are subscribed to the ggplot2
>> >>> >> mailing list.
>> >>> >> Please provide a reproducible example:
>> https://github.com/hadley/devt
>> >>> >> ools/wiki/Reproducibility
>> >>> >>
>> >>> >> To post: email ggpl...@googlegroups.com
>> >>> >> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
>> >>> >> More options: http://groups.google.com/group/ggplot2
>> >>> >>
>> >>> >> ---
>> >>> >> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> >> "ggplot2" group.
>> >>> >> To unsubscribe from this group and stop receiving emails from it,
>> >>> send an
>> >>> >> email to ggplot2+unsubscr...@googlegroups.com.
>> >>> >> For more options, visit https://groups.google.com/d/optout.
>> >>> >>
>> >>> >
>> >>> >
>> >>> >
>> >>> > --
>> >>> > In God we trust, all others bring data.
>> >>> >
>> >>>
>> >>> [[alternative HTML version deleted]]
>> >>>
>> >>> __
>> >>> 

Re: [R] Steps to create spatial plots

2018-01-15 Thread Adriano Fantini
the latest ggplot from github (to be installed with
`devtools:install_github()`) has support for SF objects too, it's a treat!
However, sf is not exactly designed for raster data. Of course you can make
each of your cells be a square polygon, but it's not the most efficient way
for big datasets. For this the `raster` (excellent and rock stable) and
`stars` (even more excellent, but in heavy development) can be used.

Adriano Fantini

2018-01-15 23:26 GMT+01:00 Roman Luštrik :

> You will need to coerce your data into a "spatial" kind, as implemented in
> `sp` or as of late, `sf` packages. You might want to give the vignettes a
> whirl before you proceed.
> Roughly, you will have to coerce the data to Spatial* (you could go for a
> point, raster or grid type, I think) and also specify the projection. Once
> you have that, plotting should be handled by packages.
>
> Here are a few quick links that might come handy:
>
> https://cran.r-project.org/web/views/Spatial.html
> http://www.datacarpentry.org/R-spatial-raster-vector-
> lesson/10-vector-csv-to-shapefile-in-r/
>
>
> Cheers,
> Roman
>
> On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:
>
>> Hi users,
>>
>> I have no clear clue about plotting spatial data. For example, I just
>> have a table with attribute values of each grid cell, such as elevation.
>> Then I have coordinates of the upper left corner in UTM, the number of rows
>> and columns, and grid cell size. How to create spatial plot of elevations
>> for the grid cells, in color ramp? Should I create a spatial grid layer
>> with all the polygons first? Thanks.
>>
>> --
>> --
>> You received this message because you are subscribed to the ggplot2
>> mailing list.
>> Please provide a reproducible example: https://github.com/hadley/devt
>> ools/wiki/Reproducibility
>>
>> To post: email ggpl...@googlegroups.com
>> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
>> More options: http://groups.google.com/group/ggplot2
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ggplot2" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ggplot2+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> In God we trust, all others bring data.
>
> --
> --
> You received this message because you are subscribed to the ggplot2
> mailing list.
> Please provide a reproducible example: https://github.com/hadley/
> devtools/wiki/Reproducibility
>
> To post: email ggpl...@googlegroups.com
> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Steps to create spatial plots

2018-01-15 Thread Eric Berger
If layer$z is a matrix and you want to reverse the order of the rows, you
can do:

n <- nrow(layer$z)
layer$z <- layer$z[ n:1, ]

HTH,
Eric


On Tue, Jan 16, 2018 at 8:43 AM, lily li  wrote:

> Sorry for the emails, I just wanted to have an example.
> layer$z
>
> 1  1  3  4  6  2
> 2  3  4  1  2  9
> 1  4  5  2  1  8
>
> How to convert the matrix to layer$z = c(1, 4, 5, 2, 1, 8, 2, 3, 4, 1, 2,
> 9, 1, 1, 3, 4, 6, 2)?
> I think this vector is the order that levelplot can use. Thanks again.
>
>
> On Mon, Jan 15, 2018 at 10:58 PM, lily li  wrote:
>
> > Hi Bert,
> >
> > I think you are correct that I can use levelplot, but I have a question
> > about converting data. For example, the statement:
> > levelplot(Z~X*Y), Z is row-wise from the lower left corner to the upper
> > right corner.
> > My dataset just have gridded Z data as a txt file (or can be called
> > matrix?), how to convert them to the vector in order for levelplot to
> use?
> > Thanks.
> >
> > On Mon, Jan 15, 2018 at 6:04 PM, Bert Gunter 
> > wrote:
> >
> >> From your description, I am **guessing** that you may not want a
> "spatial
> >> map" (including projections) at all, but rather something like a level
> >> plot. See ?levelplot in the lattice package for details. Both I am sure
> >> ggplot2 has something similar.
> >>
> >> Apologies if I havemisunderstood your intent/specifications.
> >>
> >> Cheers,
> >> Bert
> >>
> >>
> >> Bert Gunter
> >>
> >> "The trouble with having an open mind is that people keep coming along
> >> and sticking things into it."
> >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> >>
> >> On Mon, Jan 15, 2018 at 4:54 PM, lily li  wrote:
> >>
> >>> Hi Roman,
> >>>
> >>> Thanks for your reply. For the spatial coordinates layer, I just have
> >>> coordinates of the upper left corner, numbers of rows and columns of
> the
> >>> spatial map, and grid cell size. How to create a spatial layer of
> >>> coordinates from this data? Thanks.
> >>>
> >>>
> >>> On Mon, Jan 15, 2018 at 3:26 PM, Roman Luštrik <
> roman.lust...@gmail.com>
> >>> wrote:
> >>>
> >>> > You will need to coerce your data into a "spatial" kind, as
> >>> implemented in
> >>> > `sp` or as of late, `sf` packages. You might want to give the
> >>> vignettes a
> >>> > whirl before you proceed.
> >>> > Roughly, you will have to coerce the data to Spatial* (you could go
> >>> for a
> >>> > point, raster or grid type, I think) and also specify the projection.
> >>> Once
> >>> > you have that, plotting should be handled by packages.
> >>> >
> >>> > Here are a few quick links that might come handy:
> >>> >
> >>> > https://cran.r-project.org/web/views/Spatial.html
> >>> > http://www.datacarpentry.org/R-spatial-raster-vector-
> >>> > lesson/10-vector-csv-to-shapefile-in-r/
> >>> >
> >>> >
> >>> > Cheers,
> >>> > Roman
> >>> >
> >>> > On Mon, Jan 15, 2018 at 11:22 PM, lily li 
> wrote:
> >>> >
> >>> >> Hi users,
> >>> >>
> >>> >> I have no clear clue about plotting spatial data. For example, I
> just
> >>> >> have a table with attribute values of each grid cell, such as
> >>> elevation.
> >>> >> Then I have coordinates of the upper left corner in UTM, the number
> >>> of rows
> >>> >> and columns, and grid cell size. How to create spatial plot of
> >>> elevations
> >>> >> for the grid cells, in color ramp? Should I create a spatial grid
> >>> layer
> >>> >> with all the polygons first? Thanks.
> >>> >>
> >>> >> --
> >>> >> --
> >>> >> You received this message because you are subscribed to the ggplot2
> >>> >> mailing list.
> >>> >> Please provide a reproducible example:
> https://github.com/hadley/devt
> >>> >> ools/wiki/Reproducibility
> >>> >>
> >>> >> To post: email ggpl...@googlegroups.com
> >>> >> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
> >>> >> More options: http://groups.google.com/group/ggplot2
> >>> >>
> >>> >> ---
> >>> >> You received this message because you are subscribed to the Google
> >>> Groups
> >>> >> "ggplot2" group.
> >>> >> To unsubscribe from this group and stop receiving emails from it,
> >>> send an
> >>> >> email to ggplot2+unsubscr...@googlegroups.com.
> >>> >> For more options, visit https://groups.google.com/d/optout.
> >>> >>
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > In God we trust, all others bring data.
> >>> >
> >>>
> >>> [[alternative HTML version deleted]]
> >>>
> >>> __
> >>> R-help@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/posti
> >>> ng-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
> >>
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 

Re: [R] Steps to create spatial plots

2018-01-15 Thread lily li
Sorry for the emails, I just wanted to have an example.
layer$z

1  1  3  4  6  2
2  3  4  1  2  9
1  4  5  2  1  8

How to convert the matrix to layer$z = c(1, 4, 5, 2, 1, 8, 2, 3, 4, 1, 2,
9, 1, 1, 3, 4, 6, 2)?
I think this vector is the order that levelplot can use. Thanks again.


On Mon, Jan 15, 2018 at 10:58 PM, lily li  wrote:

> Hi Bert,
>
> I think you are correct that I can use levelplot, but I have a question
> about converting data. For example, the statement:
> levelplot(Z~X*Y), Z is row-wise from the lower left corner to the upper
> right corner.
> My dataset just have gridded Z data as a txt file (or can be called
> matrix?), how to convert them to the vector in order for levelplot to use?
> Thanks.
>
> On Mon, Jan 15, 2018 at 6:04 PM, Bert Gunter 
> wrote:
>
>> From your description, I am **guessing** that you may not want a "spatial
>> map" (including projections) at all, but rather something like a level
>> plot. See ?levelplot in the lattice package for details. Both I am sure
>> ggplot2 has something similar.
>>
>> Apologies if I havemisunderstood your intent/specifications.
>>
>> Cheers,
>> Bert
>>
>>
>> Bert Gunter
>>
>> "The trouble with having an open mind is that people keep coming along
>> and sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>
>> On Mon, Jan 15, 2018 at 4:54 PM, lily li  wrote:
>>
>>> Hi Roman,
>>>
>>> Thanks for your reply. For the spatial coordinates layer, I just have
>>> coordinates of the upper left corner, numbers of rows and columns of the
>>> spatial map, and grid cell size. How to create a spatial layer of
>>> coordinates from this data? Thanks.
>>>
>>>
>>> On Mon, Jan 15, 2018 at 3:26 PM, Roman Luštrik 
>>> wrote:
>>>
>>> > You will need to coerce your data into a "spatial" kind, as
>>> implemented in
>>> > `sp` or as of late, `sf` packages. You might want to give the
>>> vignettes a
>>> > whirl before you proceed.
>>> > Roughly, you will have to coerce the data to Spatial* (you could go
>>> for a
>>> > point, raster or grid type, I think) and also specify the projection.
>>> Once
>>> > you have that, plotting should be handled by packages.
>>> >
>>> > Here are a few quick links that might come handy:
>>> >
>>> > https://cran.r-project.org/web/views/Spatial.html
>>> > http://www.datacarpentry.org/R-spatial-raster-vector-
>>> > lesson/10-vector-csv-to-shapefile-in-r/
>>> >
>>> >
>>> > Cheers,
>>> > Roman
>>> >
>>> > On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:
>>> >
>>> >> Hi users,
>>> >>
>>> >> I have no clear clue about plotting spatial data. For example, I just
>>> >> have a table with attribute values of each grid cell, such as
>>> elevation.
>>> >> Then I have coordinates of the upper left corner in UTM, the number
>>> of rows
>>> >> and columns, and grid cell size. How to create spatial plot of
>>> elevations
>>> >> for the grid cells, in color ramp? Should I create a spatial grid
>>> layer
>>> >> with all the polygons first? Thanks.
>>> >>
>>> >> --
>>> >> --
>>> >> You received this message because you are subscribed to the ggplot2
>>> >> mailing list.
>>> >> Please provide a reproducible example: https://github.com/hadley/devt
>>> >> ools/wiki/Reproducibility
>>> >>
>>> >> To post: email ggpl...@googlegroups.com
>>> >> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
>>> >> More options: http://groups.google.com/group/ggplot2
>>> >>
>>> >> ---
>>> >> You received this message because you are subscribed to the Google
>>> Groups
>>> >> "ggplot2" group.
>>> >> To unsubscribe from this group and stop receiving emails from it,
>>> send an
>>> >> email to ggplot2+unsubscr...@googlegroups.com.
>>> >> For more options, visit https://groups.google.com/d/optout.
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > In God we trust, all others bring data.
>>> >
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@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/posti
>>> ng-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Steps to create spatial plots

2018-01-15 Thread lily li
Hi Bert,

I think you are correct that I can use levelplot, but I have a question
about converting data. For example, the statement:
levelplot(Z~X*Y), Z is row-wise from the lower left corner to the upper
right corner.
My dataset just have gridded Z data as a txt file (or can be called
matrix?), how to convert them to the vector in order for levelplot to use?
Thanks.

On Mon, Jan 15, 2018 at 6:04 PM, Bert Gunter  wrote:

> From your description, I am **guessing** that you may not want a "spatial
> map" (including projections) at all, but rather something like a level
> plot. See ?levelplot in the lattice package for details. Both I am sure
> ggplot2 has something similar.
>
> Apologies if I havemisunderstood your intent/specifications.
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
> On Mon, Jan 15, 2018 at 4:54 PM, lily li  wrote:
>
>> Hi Roman,
>>
>> Thanks for your reply. For the spatial coordinates layer, I just have
>> coordinates of the upper left corner, numbers of rows and columns of the
>> spatial map, and grid cell size. How to create a spatial layer of
>> coordinates from this data? Thanks.
>>
>>
>> On Mon, Jan 15, 2018 at 3:26 PM, Roman Luštrik 
>> wrote:
>>
>> > You will need to coerce your data into a "spatial" kind, as implemented
>> in
>> > `sp` or as of late, `sf` packages. You might want to give the vignettes
>> a
>> > whirl before you proceed.
>> > Roughly, you will have to coerce the data to Spatial* (you could go for
>> a
>> > point, raster or grid type, I think) and also specify the projection.
>> Once
>> > you have that, plotting should be handled by packages.
>> >
>> > Here are a few quick links that might come handy:
>> >
>> > https://cran.r-project.org/web/views/Spatial.html
>> > http://www.datacarpentry.org/R-spatial-raster-vector-
>> > lesson/10-vector-csv-to-shapefile-in-r/
>> >
>> >
>> > Cheers,
>> > Roman
>> >
>> > On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:
>> >
>> >> Hi users,
>> >>
>> >> I have no clear clue about plotting spatial data. For example, I just
>> >> have a table with attribute values of each grid cell, such as
>> elevation.
>> >> Then I have coordinates of the upper left corner in UTM, the number of
>> rows
>> >> and columns, and grid cell size. How to create spatial plot of
>> elevations
>> >> for the grid cells, in color ramp? Should I create a spatial grid layer
>> >> with all the polygons first? Thanks.
>> >>
>> >> --
>> >> --
>> >> You received this message because you are subscribed to the ggplot2
>> >> mailing list.
>> >> Please provide a reproducible example: https://github.com/hadley/devt
>> >> ools/wiki/Reproducibility
>> >>
>> >> To post: email ggpl...@googlegroups.com
>> >> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
>> >> More options: http://groups.google.com/group/ggplot2
>> >>
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "ggplot2" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> an
>> >> email to ggplot2+unsubscr...@googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >
>> >
>> >
>> > --
>> > In God we trust, all others bring data.
>> >
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Steps to create spatial plots

2018-01-15 Thread lily li
The projection is UTM zone, but I meant that I don't have coordinates for
each grid cell, rather, I have coordinates for the upper left corner. The
attribute layer is elevation for each grid cell for example, I assume that
I need to create coordinates for the grid cells first? Thanks.

On Mon, Jan 15, 2018 at 6:04 PM, Bert Gunter  wrote:

> From your description, I am **guessing** that you may not want a "spatial
> map" (including projections) at all, but rather something like a level
> plot. See ?levelplot in the lattice package for details. Both I am sure
> ggplot2 has something similar.
>
> Apologies if I havemisunderstood your intent/specifications.
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
> On Mon, Jan 15, 2018 at 4:54 PM, lily li  wrote:
>
>> Hi Roman,
>>
>> Thanks for your reply. For the spatial coordinates layer, I just have
>> coordinates of the upper left corner, numbers of rows and columns of the
>> spatial map, and grid cell size. How to create a spatial layer of
>> coordinates from this data? Thanks.
>>
>>
>> On Mon, Jan 15, 2018 at 3:26 PM, Roman Luštrik 
>> wrote:
>>
>> > You will need to coerce your data into a "spatial" kind, as implemented
>> in
>> > `sp` or as of late, `sf` packages. You might want to give the vignettes
>> a
>> > whirl before you proceed.
>> > Roughly, you will have to coerce the data to Spatial* (you could go for
>> a
>> > point, raster or grid type, I think) and also specify the projection.
>> Once
>> > you have that, plotting should be handled by packages.
>> >
>> > Here are a few quick links that might come handy:
>> >
>> > https://cran.r-project.org/web/views/Spatial.html
>> > http://www.datacarpentry.org/R-spatial-raster-vector-
>> > lesson/10-vector-csv-to-shapefile-in-r/
>> >
>> >
>> > Cheers,
>> > Roman
>> >
>> > On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:
>> >
>> >> Hi users,
>> >>
>> >> I have no clear clue about plotting spatial data. For example, I just
>> >> have a table with attribute values of each grid cell, such as
>> elevation.
>> >> Then I have coordinates of the upper left corner in UTM, the number of
>> rows
>> >> and columns, and grid cell size. How to create spatial plot of
>> elevations
>> >> for the grid cells, in color ramp? Should I create a spatial grid layer
>> >> with all the polygons first? Thanks.
>> >>
>> >> --
>> >> --
>> >> You received this message because you are subscribed to the ggplot2
>> >> mailing list.
>> >> Please provide a reproducible example: https://github.com/hadley/devt
>> >> ools/wiki/Reproducibility
>> >>
>> >> To post: email ggpl...@googlegroups.com
>> >> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
>> >> More options: http://groups.google.com/group/ggplot2
>> >>
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "ggplot2" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> an
>> >> email to ggplot2+unsubscr...@googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >
>> >
>> >
>> > --
>> > In God we trust, all others bring data.
>> >
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Steps to create spatial plots

2018-01-15 Thread Bert Gunter
From your description, I am **guessing** that you may not want a "spatial
map" (including projections) at all, but rather something like a level
plot. See ?levelplot in the lattice package for details. Both I am sure
ggplot2 has something similar.

Apologies if I havemisunderstood your intent/specifications.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Mon, Jan 15, 2018 at 4:54 PM, lily li  wrote:

> Hi Roman,
>
> Thanks for your reply. For the spatial coordinates layer, I just have
> coordinates of the upper left corner, numbers of rows and columns of the
> spatial map, and grid cell size. How to create a spatial layer of
> coordinates from this data? Thanks.
>
>
> On Mon, Jan 15, 2018 at 3:26 PM, Roman Luštrik 
> wrote:
>
> > You will need to coerce your data into a "spatial" kind, as implemented
> in
> > `sp` or as of late, `sf` packages. You might want to give the vignettes a
> > whirl before you proceed.
> > Roughly, you will have to coerce the data to Spatial* (you could go for a
> > point, raster or grid type, I think) and also specify the projection.
> Once
> > you have that, plotting should be handled by packages.
> >
> > Here are a few quick links that might come handy:
> >
> > https://cran.r-project.org/web/views/Spatial.html
> > http://www.datacarpentry.org/R-spatial-raster-vector-
> > lesson/10-vector-csv-to-shapefile-in-r/
> >
> >
> > Cheers,
> > Roman
> >
> > On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:
> >
> >> Hi users,
> >>
> >> I have no clear clue about plotting spatial data. For example, I just
> >> have a table with attribute values of each grid cell, such as elevation.
> >> Then I have coordinates of the upper left corner in UTM, the number of
> rows
> >> and columns, and grid cell size. How to create spatial plot of
> elevations
> >> for the grid cells, in color ramp? Should I create a spatial grid layer
> >> with all the polygons first? Thanks.
> >>
> >> --
> >> --
> >> You received this message because you are subscribed to the ggplot2
> >> mailing list.
> >> Please provide a reproducible example: https://github.com/hadley/devt
> >> ools/wiki/Reproducibility
> >>
> >> To post: email ggpl...@googlegroups.com
> >> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
> >> More options: http://groups.google.com/group/ggplot2
> >>
> >> ---
> >> You received this message because you are subscribed to the Google
> Groups
> >> "ggplot2" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to ggplot2+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> >
> >
> >
> > --
> > In God we trust, all others bring data.
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Steps to create spatial plots

2018-01-15 Thread lily li
Hi Roman,

Thanks for your reply. For the spatial coordinates layer, I just have
coordinates of the upper left corner, numbers of rows and columns of the
spatial map, and grid cell size. How to create a spatial layer of
coordinates from this data? Thanks.


On Mon, Jan 15, 2018 at 3:26 PM, Roman Luštrik 
wrote:

> You will need to coerce your data into a "spatial" kind, as implemented in
> `sp` or as of late, `sf` packages. You might want to give the vignettes a
> whirl before you proceed.
> Roughly, you will have to coerce the data to Spatial* (you could go for a
> point, raster or grid type, I think) and also specify the projection. Once
> you have that, plotting should be handled by packages.
>
> Here are a few quick links that might come handy:
>
> https://cran.r-project.org/web/views/Spatial.html
> http://www.datacarpentry.org/R-spatial-raster-vector-
> lesson/10-vector-csv-to-shapefile-in-r/
>
>
> Cheers,
> Roman
>
> On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:
>
>> Hi users,
>>
>> I have no clear clue about plotting spatial data. For example, I just
>> have a table with attribute values of each grid cell, such as elevation.
>> Then I have coordinates of the upper left corner in UTM, the number of rows
>> and columns, and grid cell size. How to create spatial plot of elevations
>> for the grid cells, in color ramp? Should I create a spatial grid layer
>> with all the polygons first? Thanks.
>>
>> --
>> --
>> You received this message because you are subscribed to the ggplot2
>> mailing list.
>> Please provide a reproducible example: https://github.com/hadley/devt
>> ools/wiki/Reproducibility
>>
>> To post: email ggpl...@googlegroups.com
>> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
>> More options: http://groups.google.com/group/ggplot2
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "ggplot2" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ggplot2+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> In God we trust, all others bring data.
>

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Steps to create spatial plots

2018-01-15 Thread Jeff Newmiller

Also note that there is an R-sig-geo mailing list dedicated to this topic.

You might also like to look at [1] for more on coordinate projections.

[1] 
https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/OverviewCoordinateReferenceSystems.pdf

On Mon, 15 Jan 2018, Roman Lu?trik wrote:


You will need to coerce your data into a "spatial" kind, as implemented in
`sp` or as of late, `sf` packages. You might want to give the vignettes a
whirl before you proceed.
Roughly, you will have to coerce the data to Spatial* (you could go for a
point, raster or grid type, I think) and also specify the projection. Once
you have that, plotting should be handled by packages.

Here are a few quick links that might come handy:

https://cran.r-project.org/web/views/Spatial.html
http://www.datacarpentry.org/R-spatial-raster-vector-lesson/10-vector-csv-to-shapefile-in-r/


Cheers,
Roman

On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:


Hi users,

I have no clear clue about plotting spatial data. For example, I just have
a table with attribute values of each grid cell, such as elevation. Then I
have coordinates of the upper left corner in UTM, the number of rows and
columns, and grid cell size. How to create spatial plot of elevations for
the grid cells, in color ramp? Should I create a spatial grid layer with
all the polygons first? Thanks.

--
--
You received this message because you are subscribed to the ggplot2
mailing list.
Please provide a reproducible example: https://github.com/hadley/
devtools/wiki/Reproducibility

To post: email ggpl...@googlegroups.com
To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups
"ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ggplot2+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.





--
In God we trust, all others bring data.

[[alternative HTML version deleted]]

__
R-help@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.



---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
R-help@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.


Re: [R] Steps to create spatial plots

2018-01-15 Thread Roman Luštrik
You will need to coerce your data into a "spatial" kind, as implemented in
`sp` or as of late, `sf` packages. You might want to give the vignettes a
whirl before you proceed.
Roughly, you will have to coerce the data to Spatial* (you could go for a
point, raster or grid type, I think) and also specify the projection. Once
you have that, plotting should be handled by packages.

Here are a few quick links that might come handy:

https://cran.r-project.org/web/views/Spatial.html
http://www.datacarpentry.org/R-spatial-raster-vector-lesson/10-vector-csv-to-shapefile-in-r/


Cheers,
Roman

On Mon, Jan 15, 2018 at 11:22 PM, lily li  wrote:

> Hi users,
>
> I have no clear clue about plotting spatial data. For example, I just have
> a table with attribute values of each grid cell, such as elevation. Then I
> have coordinates of the upper left corner in UTM, the number of rows and
> columns, and grid cell size. How to create spatial plot of elevations for
> the grid cells, in color ramp? Should I create a spatial grid layer with
> all the polygons first? Thanks.
>
> --
> --
> You received this message because you are subscribed to the ggplot2
> mailing list.
> Please provide a reproducible example: https://github.com/hadley/
> devtools/wiki/Reproducibility
>
> To post: email ggpl...@googlegroups.com
> To unsubscribe: email ggplot2+unsubscr...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
In God we trust, all others bring data.

[[alternative HTML version deleted]]

__
R-help@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.