ol_scale_size_continuous | R Documentation |
Specify a continuous size mapping for a point layer.
ol_scale_size_continuous(low.val, high.val, low.size = 0.33, high.size = 0.75, name = NULL, na.size.val = 0.33, draw.fill = NULL, legend.breaks = NULL, display = FALSE)
low.val |
numeric the minimum variable value to be mapped to the smallest size. |
high.val |
numeric the maximum variable value to be mapped to the largest size. |
low.size |
numeric smallest size scalar. |
high.size |
numeric largest size scalar. |
name |
character the scale name. |
na.size.val |
numeric the size scalar assigned to non-numeric or NA values. |
draw.fill |
character fill color for drawing points in the legend only. |
legend.breaks |
numeric ordered vector of variable values to display in the legend. |
display |
logical indicating whether to draw the scale for output
in the HTML. If |
This method maps OpenLayers point feature sizes 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 "size" mapping to a numeric variable. If no such layer exists, attempts to add this type of scale will result in a warning. Attempt to apply this scale to a non-numeric variable will throw an error.
Size inputs to this method are applied as scalars to the icon widths. A size value of 1 translates to an icon width of 40 pixels for "pin" markers, or 20 pixels for "dot" markers.
list of class Scale.Size.Continuous
.
ol_map
,
ol_geom_point
,
point.matrix <- matrix( c( -80.885+runif(10), 25.223+runif(10) ), ncol=2 ) point.df <- data.frame( pt.type=sample(c("A","B"),10,replace=TRUE), pt.numeric=runif(10)*10 ) miami.points.map <- ol_map( center=c(-80.385790,25.782618), zoom=10 ) + streetmap()+ ol_geom_point( point.matrix, df=point.df, mapping=ol_aes( size=pt.numeric # continuous mapping ), name="Point", marker="pin", fill='green', toggle.control=TRUE, tooltip=sprintf("%1.2f",point.df$pt.numeric) ) + ol_scale_size_continuous( high.val=10, low.val=0, high.size=0.66, low.size=0.33, draw.fill='green', legend.breaks=c(0,3.33,6.67,10), display=TRUE ) ## Not run: # Oave to file and open on browser ol_map2HTML( miami.points.map, 'pointsizes.html' ) browseURL('pointsizes.html') ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.