Skip to content

Colors in package plotGoogleMaps

2 messages · luca candeloro, Milan Kilibarda

#
Dear Luca,

It is not difficult to set colors by attributes. According to your example.

plotGoogleMaps(nc,zcol="NWBIR74",filename='MyMap.htm',mapTypeId='TERRAIN',colPalette=rainbow(5))

It sets colors by argument NWBIR74 . It makes 5 categories of argument
NWBIR74 and gives colors from rainbow palette. It is better to use
palettes from RColorBrewer package.

If you want to set border color just add strokeColor="red" e.g.:

plotGoogleMaps(nc,zcol="NWBIR74",filename='MyMap.htm',mapTypeId='TERRAIN',colPalette=rainbow(5),strokeColor="red")

If you want to create new argument in form of factor you then just need to
set colPallete colors which has the same number of colors as levels of
your categories (factor argument).

I hope it helps.

Milan
Milan Kilibarda

University of Belgrade,
Faculty of Civil Engineering,
Department of Geodesy and Geoinformatics,
Address: Bulevar kralja Aleksandra 73
   11000 Belgrade, Serbia,
Mail:kili at grf.bg.ac.rs

tel:+381 11 3218516