Title: Visualize Spatial Data using 'roughjs'
Version: 1.0.0
Description: Draw maps using the 'javascript' library 'roughjs'. This allows to draw sketchy, hand-drawn-like maps.
URL: https://github.com/schochastics/roughsf
BugReports: https://github.com/schochastics/roughsf/issues
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.1
Imports: htmlwidgets, jsonlite, sf
Suggests: pagedown
NeedsCompilation: no
Packaged: 2022-10-04 06:43:16 UTC; david
Author: David Schoch ORCID iD [aut, cre]
Maintainer: David Schoch <david@schochastics.net>
Repository: CRAN
Date/Publication: 2022-10-04 10:20:02 UTC

Create a rough map

Description

plot a sf map using rough.js

Usage

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"
)

Arguments

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

Details

The following attributes are supported for POLYGONS:

The following attributes are supported for LINESTRINGS:

The following attributes are supported for POINTS:

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()

Value

htmlwidget containing the drawn network

References

More details on roughjs can be found on https://github.com/rough-stuff/rough/wiki

Examples

library(sf)
demo(nc, ask = FALSE, echo = FALSE)
nc_poly <- st_cast(nc,"POLYGON",warn = FALSE)
roughsf(nc_poly)

Save roughsf plot to file

Description

Save roughsf plot to file

Usage

save_roughsf(rsf, file, background = "white", wait = 4)

Arguments

rsf

result from calling the function roughsf

file

filename

background

string giving the html background color

wait

time in seconds to wait for page load

Value

No return value, called for side effect