Created
April 24, 2020 03:13
-
-
Save Maschette/74851dd9347af06fd953d91ca7d51574 to your computer and use it in GitHub Desktop.
SOmap_auto colors examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I will add this to a vignette at some point. | |
``` r | |
library(SOmap) | |
#> Loading required package: raster | |
#> Loading required package: sp | |
df<-data.frame(x=runif(10, 130, 200), y=runif(10, -80, -10), cols=rep(1:2,5)) | |
df | |
#> x y cols | |
#> 1 164.8350 -71.04712 1 | |
#> 2 135.2989 -66.59820 2 | |
#> 3 178.0289 -63.32902 1 | |
#> 4 158.7891 -76.32440 2 | |
#> 5 186.0773 -14.80976 1 | |
#> 6 198.8621 -44.82528 2 | |
#> 7 165.5377 -13.36975 1 | |
#> 8 187.6287 -62.17930 2 | |
#> 9 177.1094 -67.66354 1 | |
#> 10 188.0247 -17.50000 2 | |
SOmap_auto(df$x, df$y, pcol = df$cols, input_lines = FALSE) | |
``` | |
![](https://i.imgur.com/A7AOaBC.png) | |
``` r | |
SOmap_auto(df$x, df$y, input_points = FALSE, input_lines = FALSE) | |
SOplot(df$x[df$cols==1], df$y[df$cols==1], col=3,type="o") | |
#> No projection provided, assuming longlat | |
SOplot(df$x[df$cols==2], df$y[df$cols==2], col=1,type="o") | |
#> No projection provided, assuming longlat | |
``` | |
![](https://i.imgur.com/mDsrUPu.png) | |
``` r | |
df<-data.frame(x=runif(100, 130, 200), y=runif(100, -80, -10), cols=rep(1:10,10)) | |
df | |
#> x y cols | |
#> 1 155.1702 -72.19939 1 | |
#> 2 178.1013 -16.63224 2 | |
#> 3 152.8900 -32.85208 3 | |
#> 4 170.2737 -50.20981 4 | |
#> 5 139.6257 -55.53175 5 | |
#> 6 175.9109 -74.47346 6 | |
#> 7 167.4145 -23.59732 7 | |
#> 8 143.0540 -64.94174 8 | |
#> 9 192.0872 -10.04713 9 | |
#> 10 176.0054 -63.96012 10 | |
heats<-heat.colors(10) | |
SOmap_auto(df$x, df$y, input_points = FALSE, input_lines = FALSE) | |
for(i in unique(df$cols)){ | |
SOplot(df$x[df$cols==i], df$y[df$cols==i], col=heats[i],type="o") | |
} | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
#> No projection provided, assuming longlat | |
``` | |
![](https://i.imgur.com/XfqBCy3.png) | |
<sup>Created on 2020-04-24 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)</sup> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment