Title: | Visualize Spatial Data using 'roughjs' |
---|---|
Description: | Draw maps using the 'javascript' library 'roughjs'. This allows to draw sketchy, hand-drawn-like maps. |
Authors: | David Schoch [aut, cre] |
Maintainer: | David Schoch <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-11-22 05:37:57 UTC |
Source: | https://github.com/schochastics/roughsf |
plot a sf map using rough.js
roughsf( layers, roughness = 1, bowing = 1, simplification = 1, font = "30px Arial", title = NULL, title_font = "30px Arial", caption = NULL, caption_font = "30px Arial", width = NULL, height = NULL, elementId = NULL, chunk_name = "canvas" )
roughsf( layers, roughness = 1, bowing = 1, simplification = 1, font = "30px Arial", title = NULL, title_font = "30px Arial", caption = NULL, caption_font = "30px Arial", width = NULL, height = NULL, elementId = NULL, chunk_name = "canvas" )
layers |
an sf object or a list of sf object. each object should only contain one type of geometry. |
roughness |
numeric vector for roughness of lines |
bowing |
numeric vector for bowing of lines |
simplification |
simplify drawings (remove points from objects) |
font |
font size and font family for labels |
title |
optional title of the map |
title_font |
font size and font family for title |
caption |
optional caption of the map |
caption_font |
font size and font family for caption |
width |
width |
height |
height |
elementId |
DOM id |
chunk_name |
markdown specific |
The following attributes are supported for POLYGONS:
fill fill color
color stroke color
stroke stroke size
fillstyle one of "hachure", "solid", "zigzag", "cross-hatch", "dots", "dashed", "zigzag-line"
fillweight thickness of fillstyle (between 0 and 1)
hachureangle angle of hachure lines
hachuregap gap between two hachure lines
The following attributes are supported for LINESTRINGS:
color stroke color
stroke stroke size
The following attributes are supported for POINTS:
color color of point
size size of point
label label to be added (optional)
label_pos position of label relative to point: (c)enter, (n)orth, (e)ast, (s)outh, (w)est (optional)
Default values are used if one of the attributes is not found.
The result of a roughsf call can be printed to file with save_roughsf()
htmlwidget containing the drawn network
More details on roughjs can be found on https://github.com/rough-stuff/rough/wiki
library(sf) demo(nc, ask = FALSE, echo = FALSE) nc_poly <- st_cast(nc,"POLYGON",warn = FALSE) roughsf(nc_poly)
library(sf) demo(nc, ask = FALSE, echo = FALSE) nc_poly <- st_cast(nc,"POLYGON",warn = FALSE) roughsf(nc_poly)
Save roughsf plot to file
save_roughsf(rsf, file, background = "white", wait = 4)
save_roughsf(rsf, file, background = "white", wait = 4)
rsf |
result from calling the function |
file |
filename |
background |
string giving the html background color |
wait |
time in seconds to wait for page load |
No return value, called for side effect