Giter VIP home page Giter VIP logo

mapsf's People

Contributors

huguespecout avatar paulc91 avatar rcarto avatar rysebaert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapsf's Issues

Map axes labels

Hi, I can't find a way to include axes labels around the maps created by mapsf package. Could you please suggest a workaround. Thanks!

Integrating mapsf into a function

Hello - I am trying to get the map object as a return from a function - see - https://edouard-legoupil.github.io/unhcrdatapackage/reference/plot_reg_map.html

Below is simple example

library(mapsf)
library(tidyverse)

datamtq <- mf_get_mtq()

datamtq1 <- 
  datamtq |> filter(POP > 2000)

map_mtq <- function(data){
  mapsf::mf_theme(bg ="#d4dff2", #  "#E2E7EB",  ## background color --> Used country 
                  # bg = "#cdd2d4", "#faebd7ff",  "#cdd2d4",
                  mar = c(0, 0, 2, 0), ## margins
                  tab = FALSE,  # if TRUE the title is displayed as a 'tab'
                  fg = "#0072BC",  ## foreground color --> for the top title - use UNHCR Blue..
                  pos = "left", # position, one of 'left', 'center', 'right'
                  inner = FALSE, # if TRUE the title is displayed inside the plot area.
                  line = 2, #number of lines used for the title
                  cex = 2.5, #cex of the title
                  #font = "Lato",
                  font = 1 ) #font of the title
  # Initiate a base map
  mf_init(x = data)
  mf_map(data)
  # Plot a shadow
  mapsf::mf_shadow(world,col = "grey50", cex = 0.2 , add = TRUE)
  # Set a layout
  mapsf::mf_title(txt = "Martinique ", fg = "#FFFFFF")
  mapsf::mf_credits(txt = "Credit", bg = "#ffffff80") 
  
  return(mf_map(data, var = "POP", type = "prop") )
}

map_mtq(datamtq1)
map_mtq(datamtq)

but if I do

t <- map_mtq(datamtq)
print(t)
str(t )

It seems the output of my function is not a plot object... I would like to be able to use this within Rmd chunk and the size of the image is not consistent...

Am I missing an important step?

Thanks

Impossible to turn polygon borders transparent in mf_map

When working with large polygon datasets, it would be nice to make polygon borders transparent, or of the same color as the polygon fill color, otherwise it's impossible to see the color palette. Having such option for the border argument or the lwd argument would be great. I tried lwd=0 but got an error back.

adding ... to do.call(mf_map_*()) functions

Love the package! Seriously making it easier to produce high quality graphs. Could you add the ... to the do.call(mf_map_*()) functions? Wanting to reverse pallete in mf_map(). Thanks!

exporting with multiple mf_map() calls

I'm having trouble exporting my map after multiple mf_map() calls to plot different layers. Sometimes it exports but the picture is cropped and when I change the width it doesn't export at all. I get this error if I try to c() the x values with mf_export()
Error in UseMethod("st_bbox") :
no applicable method for 'st_bbox' applied to an object of class "list"

Still new to mapping entirely in R, sorry if it's a silly question. Thanks!

Integrate Data points

Hello,
I am new to the R software. I try to integrate data points from the PGM_Gard database , in order to visualize them on my map_Gard map (h[ttps://geoservices.ign.fr/ocsge). I can't do it. Can someone give me some advice?
I can visualize the map OCCUPATION_SOL, according to the advice of Timothée Giraud.

My script :

setwd("/Users/frede/OneDrive/Documents/R/OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06/OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06/OCS_GE/1_DONNEES_LIVRAISON_2019-09-00096/OCSGE_1-1_SHP_LAMB93_D30_2015")

library(RColorBrewer)

library(sf)
Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE

library(mapsf)

map_Gard <- st_read("OCCUPATION_SOL.shp") # Données carto occsol
Reading layer OCCUPATION_SOL' from data source C:\Users\frede\OneDrive\Documents\R\OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06\OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06\OCS_GE\1_DONNEES_LIVRAISON_2019-09-00096\OCSGE_1-1_SHP_LAMB93_D30_2015\OCCUPATION_SOL.shp'
using driver `ESRI Shapefile'
Simple feature collection with 415420 features and 8 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 721015.4 ymin: 6263149 xmax: 848021.3 ymax: 6375578
Projected CRS: RGF93 / Lambert-93

PGM_Gard<- read.csv2(file = "/Users/frede/OneDrive/Documents/PGM_Gard.csv",header = TRUE) # Données présence espèce Gard
head (PGM_Gard)
Ind X.Lambert93..m. Y.Lambert93..m.
1 1 805076 6317468
2 2 830312 6313449
3 3 770532 6312107
4 4 827693 6316687
5 5 729433 6334594
6 6 792656 6320284

Overlap on published raster overlaid with polygons

I have raster, polygon, and points of the same extent and projection. I managed to plot them using mapsf and they aligned perfectly well. Why was there mismatch on the published output on rpubs platform? Here is the link to my output https://rpubs.com/Wyclife/raster_vector and the code is: (selec is polygon and spg is points, clima is a raster stack)

mf_init(selec, theme = 'default')
mf_shadow(selec, col = 'blue', cex = 3, add = TRUE)
mf_raster(clima2[[3]], add = T)
mf_map(selec,
type = 'choro',
var = 'gdp_cap_est',
pal = 'Mint',
add = TRUE,
alpha = 0,
border = 'blue')
mf_label(selec, var = 'name', col = 'red', cex = 1)
mf_map(spg2, col = 'purple', add = T)
mf_arrow()
mf_scale()

Error example Label Map

Hi,
Thanks for developing and providing this resource.

I am learing how to use it, and following the examples provided on this page.

FYI, Code in section "Label Map" does not work on my machine: the map is shown, with white labels, but the evaluation continues and eventually aborts with the error message

Error in getNamespace("grDevices") : 
  Shadow graphics device error: r error 4 (R code execution error)

Screenshot 2021-07-29 at 08 20 58

I use R version 4.0.4 (2021-02-15) on Rstudio Version 1.4.1717.

Adjust largest symbol size in mf_map(..., type = "prop*", val_max = max)

When using val_max and inches the max value in the legend should reflect the max value of the variable, not val_max.

In the following example, the first legend should have 10046 as max value and the second 37615, not 38000.

library(mapsf)
#> Le chargement a nécessité le package : sf
#> Linking to GEOS 3.7.1, GDAL 3.1.2, PROJ 7.1.0
m <- mf_get_mtq()
par(mfrow= c(1,2))
mf_map(m)
mf_map(m, "CHOM", 'prop', val_max = 38000, 
       inches = .3, leg_pos = "topright")
mf_map(m)
mf_map(m, "ACT", 'prop', val_max = 38000, 
       inches = .3, leg_pos = "topright")

max(m$CHOM)
#> [1] 10046
max(m$ACT)
#> [1] 37615

Created on 2021-03-11 by the reprex package (v1.0.0)

Expected output:

Maps are still comparable, but legends are in line with the mapped values.

mf_theme / font color

When using mf_theme, if bg = "white" and fg = "white", do you have a tips for putting the text (title + legend + labels) in another color ? In this example I don't want any color for the bg and the fg, just the text !

leg_pos description not clear for combined maps (mf_prop_typo for instance)

leg_pos description should be :
"position of the legend, two of 'topleft', 'top','topright', 'right', 'bottomright', 'bottom', 'bottomleft', 'left' or a vector of two coordinates in map units (c(x, y)). If leg_pos is 'n' then the legend is not plotted".

Moreover, is it possible to set two vectors of coordinates in map units for positioning manually two legend positions with leg_pos ?

Integrate data points

Hello,
I am new to the R software. I try to integrate data points from the PGM_Gard database, in order to visualize them on my map_Gard map (https://geoservices.ign.fr/ocsge). I can't do it. Can someone give me some advice?
I can visualize the map OCCUPATION_SOL, according to the advice of Timothée Giraud.

setwd("/Users/frede/OneDrive/Documents/R/OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06/OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06/OCS_GE/1_DONNEES_LIVRAISON_2019-09-00096/OCSGE_1-1_SHP_LAMB93_D30_2015")
library(RColorBrewer)
library(sf)
Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(mapsf)
map_Gard <- st_read("OCCUPATION_SOL.shp") # Données carto occsol
Reading layer OCCUPATION_SOL' from data source C:\Users\frede\OneDrive\Documents\R\OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06\OCS_GE_1-1_2015_SHP_LAMB93_D030_2019-09-06\OCS_GE\1_DONNEES_LIVRAISON_2019-09-00096\OCSGE_1-1_SHP_LAMB93_D30_2015\OCCUPATION_SOL.shp'
using driver `ESRI Shapefile'
Simple feature collection with 415420 features and 8 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 721015.4 ymin: 6263149 xmax: 848021.3 ymax:
Projected CRS: RGF93 / Lambert-93

PGM_Gard<- read.csv2(file = "/Users/frede/OneDrive/Documents/PGM_Gard.csv",header = TRUE) # Données présence espèce Gard
head (PGM_Gard)
ID X Y
1 1 805076 6317468
2 2 830312 #6313449
3 3 770532 6312107
4 4 827693 6316687
5 5 729433 6334594
6 6 792656 6320284

Enrich mf_background() with css like features

mf_background() adds background images underneath maps:

library(mapsf)
#> Le chargement a nécessité le package : sf
#> Linking to GEOS 3.7.1, GDAL 3.1.2, PROJ 7.1.0
mtq <- mf_get_mtq()
th <- mf_theme("default", bg = "grey20", fg = "grey80")
mf_init(mtq, theme = th)
mf_background(system.file("img/background.jpg", package = "mapsf"))
mf_map(mtq, lwd = 2, col = NA, border = "grey80", add = TRUE)
mf_title("A map with a nice background")


Created on 2021-06-18 by the reprex package (v2.0.0)

For now the image is stretched to fill the map space. I think it could be nice to mimic some CSS background features in this function.
See https://www.w3schools.com/cssref/css3_pr_background-size.asp and https://www.w3schools.com/cssref/pr_background-repeat.asp.

The idea is to add some of these features to the function:
mf_background(filename = "xxx.png", size = "cover", repeat = FALSE)

Feel free to get in touch if you want to contribute.

mf_symb partially fails with a column having only one value

Hello,

When you try to do a mf_symb analysis with a column wich takes only one value, the process fails when trying to draw the legend. Graphic is drawn but not the legend and an error occurs.

> library(mapsf)
> mtq <- mapsf::mf_get_mtq()
> 
> mtq$zzz <- 1
> mf_symb(mtq, var = "zzz", add = FALSE)
Erreur dans ytop[i] <- ybottom[i - 1] - inset : 
  l'argument de remplacement est de longueur nulle

The problem disappears if you add leg_pos='n'.

About this last parameter could I suggest adding another syntax like leg_pos=NA, since if you don't want a legend it is rather normal that it has no position and R usually says that with NULL or NA ?

Best regards

Jean-Luc LIPATZ

Bug in color assignment in 'choro', 'prop_choro' and 'symb_choro' maps when supplying "incomplete" breaks

The bug was introduced in 0.7.0 via commit 5649c0a in get_col_vec() defined in R/mf_map_utils.R

The problem appears when minimum values are not within the defined breaks.

See:

library(mapsf)
m <- mf_get_mtq()
summary(m$MED)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   11929   14457   15686   16138   17980   21761
bks <- c(13000, 14500, 15500, 18000, 21761 )
mf_map(m, "MED", "choro", breaks = bks)

And it should be:

library(mapsf)
m <- mf_get_mtq()
summary(m$MED)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   11929   14457   15686   16138   17980   21761
bks <- c(13000, 14500, 15500, 18000, 21761 )
mf_map(m, "MED", "choro", breaks = bks)

Created on 2023-07-27 with reprex v2.0.2

FR: Calculate max cex for mf_label that shows all text

I was hoping to request a feature or possibly just a solution to this problem:

I produce a large number of maps via a loop and they have varying numbers of polygons on them (but are as a whole image the same size and resolution). Because of this it means that the text size is very difficult to set right; maps with few polygons end up with tiny text but if I increase it then maps with many polygons become a mess or unreadable (I have to use overlap = TRUE as I need all the labels). Currently I attempt some convoluted calculation based on the ratio between the largest and smallest polygon areas and base it on that, but it isn't ideal.

I was hoping for a solution that would allow mf_label to calculate the ideal text size to avoid overlapping at all, or in an ideal world it would set the cex of each text to the maximum size where it remains within the polygon.

I think this might be possible by looking at the below section and instead of adjusting the locations adjusting the cex, but I haven't really looked through the code enough to be sure of that.

while (isOverlaped) {
if (!is_overlap(x1 - .5 * wid, y1 - .5 * ht, wid, ht, boxes) &&
x1 - .5 * wid > xlim[1] && y1 - .5 * ht > ylim[1] &&
x1 + .5 * wid < xlim[2] && y1 + .5 * ht < ylim[2]) {
boxes[[length(boxes) + 1]] <- c(x1 - .5 * wid, y1 - .5 * ht, wid, ht)
isOverlaped <- FALSE
} else {
theta <- theta + tstep
r <- r + rstep * tstep / (2 * pi)
x1 <- xo + sdx * r * cos(theta)
y1 <- yo + sdy * r * sin(theta)
}
}
}

Any help with this problem would be great!

mf_map() doesn't produce "typo" map of categorical variable: no error given

I have an sf object that works fine when piped straight to mf_map - it just makes a grey default base map of the areas.
One of the variables in my sfc tibble is a categorical variable (factor) — each area is assigned to a decile from 1 to 10. As this is not a continuous variable, I don't want to use a choropleth approach. The deciles are strictly categorical and ordered, not continuous.

mapsf is not producing any output for me when I use type = "typo". Nothing is plotted, no error message is provided.

here's my (pseudo) code:

my_sf_object %>%
  mapsf::mf_map(var = "regional_decile", type = "typo", pal = "Viridis")

If I use type = "choro" instead, I get a legend but still no map. Am I missing a step?

mapsf - possible to make compatible with tidyverse piping?

I am interested to try this package as it looks like it could give me a nice choropleth map with much less code than I am currently using to produce the map using ggplot() and geom_sf().

I tried copying the code from the vignette to produce a choropleth map in an R markdown chunk, and managed to produce a map. I also managed to produce one with my own data and slightly different settings. However I noticed that I could not see or initiate the plot window unless I ran the whole chunk and also couldn't figure out the following:

  1. Why is the map not assignable to an object name?
  2. Related to this, how does each additional layer / feature 'know' to add it to the preceding layer/feature?
  3. Also related to the above, it does not seem to be possible to use a + or a pipe operator %>% to link the instructions to build each layer. This means one has to repeat the name of the data to use each time (except apparently for mf_layout() which I find unintuitive).

My confusion about the syntax is partly informed by having switched to tidyverse, dplyr code and piped workflows almost exclusively some months ago, as I find this very convenient and it also seemed like a lot of packages were being developed with tidyverse compatibility in mind (including for example the sf package).

It would be helpful to understand how I can access any maps made with this package as r objects, so that I can interrogate them further or do other things with them later. For example, I would like to know what package is being used to make the map under the hood, if it is ggplot as this would mean I could add other features to it using ggplot syntax. But without an object name, I can't even do str(mymap) so I'm a bit lost.

I can see from the package documentation that it is intended both for R users and for people that normally use Qgis etc. who want to switch to R. Given this, I think there is a strong case for the map object itself being accessible, since most R users would expect this?

If the map could be assigned a name and work with pipes it would be much more intuitive for regular R and tidyverse users, like so:

# Proposed syntax with object name and piped workflow:

# Get example data from package:
study_map <- mf_get_mtq() %>% 
  mutate(POPDENS = 1e6 * POP / st_area(study_map)) %>% 

  # Initiate plot window: 
  mf_init(expandBB = rep(0, 4), 
          theme = 'dark') %>% 
  
  # Add shadow map:
  mf_shadow(col = 'magenta', 
            cex = 2, 
            add = TRUE) %>% 
  
  # Add title and credits:
  mf_layout(title = 'Martinique',
            credits = paste0('Sources: IGN, 2018
                             \nAuthor: Wyclife Agumba Oluoch
                             \n',
                             'Package: mapsf ',
                             packageVersion('mapsf'))) %>% 
  
  # Add choropleth map:
  mf_map(var = "POPDENS", 
         type = "choro", 
         breaks = "geom", 
         nbreaks = 5,
         col = "Mint", 
         border = "white", 
         lwd = 0.5, 
         leg_pos = "topright", 
         leg_title = "Population Density\n(people per km2)", 
         add = TRUE)

Maybe with this syntax an explicit call to initiate the plot window wouldn't be necessary (I notice some of the examples in the vignette are without this) but not sure.

Plotting single points ?

Hello,

I have an issue when trying to plot a single value with mf_map. For instance:

mtq<-mf_get_mtq()
mf_map(mtq)
mf_map(mtq[1,], var = c("POP", "STATUS"), type = "prop_typo")

Returns

Error in xy.coords(x, y, xlab = deparse1(substitute(x)), ylab = deparse1(substitute(y))) : 
  'x' is a list, but does not have components 'x' and 'y'

The problem actually remains when only a single row has a non-zero POP:

tmp<- mtq[0:2,]
tmp$POP<-c(10,0)
mf_map(mtq)
mf_map(tmp, var = c("POP", "STATUS"), type = "prop_typo")

returns the same error.

Is there something I'm doing wrong ? Thanks for the help.

The bg argument seems to not working

Hi @rCarto -- see my reprex below:

# remotes::install_github("riatelab/mapsf")
library(mapsf)
#> Loading required package: sf
#> Linking to GEOS 3.9.2, GDAL 3.3.2, PROJ 8.2.1; sf_use_s2() is TRUE
mtq = mf_get_mtq()
mf_map(mtq, bg = "lightblue")

Created on 2022-02-06 by the reprex package (v2.0.1)

mf_label : couleur des lignes

Merci pour ce package.

J'essaye d'afficher des labels avec des couleurs différentes suivant le label.
J'utilise "lines = true" et "overlap = FALSE".
La couleur de la ligne et du label ne sont pas identiques, j'ai l'impression que la couleur de la ligne dépend de la première couleur utilisée.

library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(mapsf)
p1 <- st_point(c(1,1))
sfc <- st_sfc(p1, p1, p1, p1)
sf <- st_sf(a = 1:4, couleur = c("orange", "red", "green", "blue"), geom = sfc)
mf_map(x = sf)
mf_label(x = sf,
  var = "a",
  cex = 1.5,
  overlap = FALSE,
  lines = TRUE,
  lwd = 4,
  col = sf$couleur
)

Created on 2022-12-22 with reprex v2.0.2
image

(suggestion) Add minimal R version

Hi,

By convenience, I use an old version of R (3.5.3).
When installing, hcl.colors was missing because it has been introduced in R 3.6.0.

I think that providing an information on R minimal version can be useful.
I perfectly understand that it can be cumbersome to test install against several versions.

This suggestion is also there to document that installation issue.
I also have R 4.0.4 and mapsf installed perfectly against it.

wrong class allocation when using breaks = "jenks" (should be right-closed)

bonjour

j'ai réalisé une carte avec mapsf et tmap
le résultat est différent entre mapsf et tmap
pour cette carte Schoelcher qui a la densité 949.68342 ne devrait pas être dans la classe 950 1895

voici le code

cordialement

# sur mon poste 
library(dplyr)
library(sf)
library(oceanis)
library(mapsf)
library(tmap)
data("palettes_insee")

rouge_3 <- palettes_insee$Insee_Rouge_0N3P
mtq <- mf_get_mtq()
mtq$dens <- as.numeric(mtq$POP /st_area(mtq$geom)) * 1000000
mf_base(mtq) 
mf_choro(x = mtq , 
         var = "dens",
         breaks = "jenks",
         pal = rouge_3,
         n = 3,
         leg_pos = "bottomleft",
         leg_title = "densité par km²",
         leg_val_rnd = 0, 
         add = TRUE)
# mf_label(x = mtq, var = "LIBGEO", overlap = FALSE,
#          col = "black", cex = 0.8)

mf_get_breaks(x = mtq$dens,  nbreaks = 3, breaks = "jenks")
# [1]   33.3211  403.1027  949.6834 1894.8637

# avant derniere  densite  Schoelcher      949.68342
# dernière densite         Fort-de-France  1894.86366  

# args(tm_fill)

tm_shape(mtq) + 
  tm_borders(lwd = 1) + 
  tm_fill(col = "dens", 
          palette = rouge_3, 
          title = "densité par km²",
          style = "jenks",
          n = 3,
          legend.is.portrait = FALSE
          ) + 
  tm_legend(position=c("left", "bottom")) 
  

@rCarto edit: format code

mf_worldmap additional arguments

I noticed with mf_worldmap there are some hard coded values in the plot function for the water background, land and overall insert frame. For some backgrounds I want to remove the frame or change the colors. My first thought is to capture more parameters via ... and check if they exist before entering the default (as is the case with the points). I would be happy to contribute but wanted to check in first.

horizontal legend

Hi,
I enjoy mapsf, but I often miss the possibility to put an horizontal legend, especially for chloropeths.

Custom font family

Hi,
Is there an easy way (or a tricky one) to use a custom font family ?
Best regards,

Don't understand how mf_inset works....

Hello,
Thanks for this great package for mapping.
To make a long story short, I want to draw a map of the Lot department from a map of France and apply a ratio from the last elections. So far so good BUT I want to insert a map of France with a symbol representing the department and this is where I don't understand the map_inset function very well ...
Basically I was thinking of doing :
mf_inset_on(dfFrance,pos="bottomleft")
mf_map(df46)
mf_inset_off()
with the original map dfFrance and the sub-map of the Lot df46
but it's the Lot that appears...
Can you help me please?
Alex

Ronds proportionnels

Bonjour,
Je ne sais pas comment faire pour réaliser une suite de cartes avec des ronds qui soient proportionnels entre elles. Existe-t-il une fonction pour fixer une valeur maximale commune à plusieurs cartes ?
En vous remerciant.

Hello,
I don’t know how to make a series of maps with rounds that are proportional to each other. Is there a function to set a common maximum value for multiple maps?
Thank you.

change mf_inset_on() params

  • Allow to pass c(x, y) in pos
  • See how difficult it would be to change cex definition from figure width share to an expansion/reduction factor.
    => it would be too difficult

check variable and type in mf_map()

  • throw a message if var="something" and type is not explicitly set (== set to "base")
  • throw an error if !type %in% available_types
  • throw an error if !var %in% names(x)

Issue installing mapsf

Hello,
I can't manage to install the mapfs library on a fresh R and R studio setup. (Debian 10).

> install.packages("mapsf")
[...]
installing to /home/sylvain/.R/x86_64-pc-linux-gnu-library/3.5/mapsf/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error : object ‘hcl.colors’ is not exported by 'namespace:grDevices'
ERROR: lazy loading failed for package ‘mapsf’
* removing ‘/home/sylvain/.R/x86_64-pc-linux-gnu-library/3.5/mapsf’
Warning in install.packages :
installation of package ‘mapsf’ had non-zero exit status
Has anyone ever encountered this problem before?

I did some research but without finding a solution. I am open to any suggestion.
All the best,
Sylvain

Integration with {maptiles}

Hi there,

Firstly thanks for this package. I really like the ease in which you can map data with appropriate legends, colours and breaks.

I'm wondering if it is possible to easily integrate the plots with a maptile from the maptile package?

I'm often mapping epidemiological indicators at quite a granular admin/health boundary level so a basemap helps to give context to the surrounding area, and I feel like without one, the shapefile will always appear like an island.

Thanks,
Paul

Upcoming sf release will break mapsf (due to switching to s2)

Please see r-spatial/sf#1649 for details, and consider commenting there in case you have issues. (this may be a tough one - I would start trying to use st_make_valid() on the failing geometry, but this may well be a deeper issue, needing a better worldmap that is valid on S2 @paleolimbot).

Running examples in ‘mapsf-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: mf_inset_on
> ### Title: Plot an inset
> ### Aliases: mf_inset_on mf_inset_off
>
> ### ** Examples
>
> mtq <- mf_get_mtq()
> mf_map(mtq)
> mf_inset_on(x = mtq[1, ], cex = .2)
> mf_map(mtq[1, ])
> mf_inset_off()
>
> mf_map(mtq)
> mf_inset_on(x = "worldmap", pos = "bottomleft")
> mf_worldmap(x = mtq)
Error in s2_geography_from_wkb(x, oriented = oriented, check = check) :
  Loop 7 is not valid: Edge 171 crosses edge 174
Calls: mf_worldmap -> suppressMessages -> withCallingHandlers
Execution halted

Using mf_get_breaks() does not work with infinite values

If a variable with NAs is used in a chloro map, the method breaks = "quantiles" does not work. It seems that na.rm = TRUE is not set in the quantile-function:

Error in quantile.default(x = var, probs = seq(0, 1, 1/n), ...) : 
missing values and NaN's not allowed if 'na.rm' is FALSE

Other methods are doing fine (fisher, q6, etc.).

Besides this small issue, I love working with mapsf.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.