Sometimes when debugging an issue with an SVG it can be difficult to distinguish adjacent areas that are similarly coloured.
svgparser::read_svg()
allows you to specify the name of a false colour palette which can be used to on the issues - or at least look like a work of Warhollian pop art while you try and figure it out!
Simply set the false_colour
argument to svgparser::read_svg()
to one of: ‘rainbow’, ‘hcl’, ‘heat’, ‘terrain’, ‘topo’, and ‘cm’.
svgparser
will then sample randomly from these standard R colour palettes instead of using the correct colour.
tiger_filename <- system.file("tiger.svg", package = "svgparser")
tiger_grob <- svgparser::read_svg(tiger_filename)
grid::grid.draw(tiger_grob)
false_colour = 'rainbow'
tiger_filename <- system.file("tiger.svg", package = "svgparser")
tiger_grob <- svgparser::read_svg(tiger_filename, false_colour = 'rainbow')
grid::grid.draw(tiger_grob)
false_colour = 'hcl'
tiger_filename <- system.file("tiger.svg", package = "svgparser")
tiger_grob <- svgparser::read_svg(tiger_filename, false_colour = 'hcl')
grid::grid.draw(tiger_grob)
false_colour = 'heat'
tiger_filename <- system.file("tiger.svg", package = "svgparser")
tiger_grob <- svgparser::read_svg(tiger_filename, false_colour = 'heat')
grid::grid.draw(tiger_grob)
false_colour = 'terrain'
tiger_filename <- system.file("tiger.svg", package = "svgparser")
tiger_grob <- svgparser::read_svg(tiger_filename, false_colour = 'terrain')
grid::grid.draw(tiger_grob)