Skip to content

stroke.color does not work properly #87

@maxmerben

Description

@maxmerben

I have a dataset in the TALD format. I want the datapoint color to denote the value of the feature and the stroke color to denote the language. However, I have a lot of languages (> 10), and I want to specify colors so that they're not shades of gray. I made a vector with all the colors I need and put them into a separate column in the dataset according to the datapoint's language. Then I tried to create the map:

library(tidyverse)
library(lingtypology)

data <- read_delim("lezgic.csv", delim = "\t")
data <- data[(data$map == "yes"),]

system_colors = c("blue2", "red2", "gold2", "green3")

lang_colors = c(
  "Agul"="lightpink1",
  "Archi"="firebrick2",
  "Budukh"="olivedrab2",
  "Kryz"="limegreen",
  "Lezgian"="mediumorchid3",
  "Rutul"="deepskyblue",
  "Tabasaran"="indianred1",
  "Tsakhur"="dodgerblue3",
  "Udi"="orange2"
)

data$color = as.character(lang_colors[data$lang])

map.feature(
  languages = data$lang,
  label = data$lang,
  features = data$value,
  title = "Numeral systems",
  popup = data$idiom,
  latitude = data$latitude,
  longitude = data$longitude,
  color = system_colors,
  stroke.features = data$lang,
  stroke.color = unique(data$color),
  tile = "Stamen.TonerLite",
  width = 10
)

The map can be seen here. The stroke's colors do not match with the languages in the legend :( For some reason, they go backwards: orange, which was supposed to be Udi (the last language in the list), is the color of Agul (the first language in the list), etc. Meanwhile, data$lang and data$color are adequate:

> data$lang
 [1] "Archi"     "Agul"      "Agul"      "Agul"      "Agul"      "Agul"     
 [7] "Agul"      "Agul"      "Agul"      "Agul"      "Agul"      "Rutul"    
[13] "Rutul"     "Rutul"     "Rutul"     "Tabasaran" "Tabasaran" "Tabasaran"
[19] "Tsakhur"   "Tsakhur"   "Lezgian"   "Lezgian"   "Lezgian"   "Lezgian"  
[25] "Lezgian"   "Lezgian"   "Lezgian"   "Lezgian"   "Lezgian"   "Budukh"   
[31] "Kryz"      "Udi"       "Udi"      
> data$color
 [1] "firebrick2"    "lightpink1"    "lightpink1"    "lightpink1"   
 [5] "lightpink1"    "lightpink1"    "lightpink1"    "lightpink1"   
 [9] "lightpink1"    "lightpink1"    "lightpink1"    "deepskyblue"  
[13] "deepskyblue"   "deepskyblue"   "deepskyblue"   "indianred1"   
[17] "indianred1"    "indianred1"    "dodgerblue3"   "dodgerblue3"  
[21] "mediumorchid3" "mediumorchid3" "mediumorchid3" "mediumorchid3"
[25] "mediumorchid3" "mediumorchid3" "mediumorchid3" "mediumorchid3"
[29] "mediumorchid3" "olivedrab2"    "limegreen"     "orange2"      
[33] "orange2"      

I don't know if it's my mistake or something is wrong with the strokes in the library. If it is my mistake, maybe you could include an example of specifying the strokes' colors in the guide?

info about OS and package versions ``` > sessionInfo()$R.version$platform [1] "x86_64-w64-mingw32" > sessionInfo()$R.version$version.string [1] "R version 4.1.1 (2021-08-10)" > packageVersion("leaflet") [1] ‘2.0.4.1’ > packageVersion("lingtypology") [1] ‘1.1.10’ ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions