ol_scale_color_continuous | R Documentation |
Specify a line (or border) color mapping scale.
ol_scale_color_continuous(low.val, high.val, low.col = NULL, high.col = NULL, rotate.clockwise = TRUE, name = NULL, na.col.val = "#FFFFFF00", opacity = 1, preserve.opacity = NULL, display = FALSE)
low.val |
numeric the minimum variable value to be mapped to the lowest color. |
high.val |
numeric the maximum variable value to be mapped to the highest color. |
low.col |
character the "low" color. |
high.col |
character the "high" color. |
rotate.clockwise |
logical. If |
name |
character the scale name. |
na.col.val |
character the color assigned to non-numeric or NA values. |
opacity |
numeric in [0,1]. The fill opacity, if not specified in
the |
preserve.opacity |
logical indicating whether to draw the legend with the same opacity as the feature fills on the map. |
display |
logical indicating whether to draw the scale for output
in the HTML. If |
This method maps OpenLayers feature line or border colors to continuous variable values. This scale can be added to an Ol.Map S3 object only if the Ol.Map object has a layer with a "color" mapping to a numeric variable. If no such layer exists, attempts to add this type of scale will result in a warning. Attempts to apply this scale to a non-numeric variable will throw an error.
list of class Scale.Color.Continuous
.
ol_map
,
ol_geom_polygon
,
ol_geom_line
line.matrix1 <- matrix( c( -80.4,-80.4, 25.78,25.88 ), ncol=2 ) line.matrix2 <- matrix( c( -80.25,-80.35, 25.65,25.65 ), ncol=2 ) line.list <- list(line.matrix1,line.matrix2) line.df <- data.frame( direction=c("vertical","horizontal"), no=runif(2) ) miami.gray.basemap <- ol_map( center=c(-80.385790,25.782618), zoom=9 ) + lightgray() line.layer <- ol_geom_line( line.list, mapping=ol_aes( color=no #continuous mapping ), df=line.df, name="Miami Lines", toggle.control=TRUE, lwd=5, tooltip=line.df$no ) line.color.scale <- ol_scale_color_continuous( low.val = 0, high.val = 1, low.col = 'red', high.col= 'green', opacity = 1, preserve.opacity = TRUE, name = "Number", display = TRUE ) line.map.miami <- miami.gray.basemap + line.layer + line.color.scale ## Not run: # Output to file and view ol_map2HTML( line.map.miami, 'miami_lines.html', map.heading="Miami Lines" ) browseURL("miami_lines.html") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.