ol_aes | R Documentation |
Map variables to layer aesthetics.
ol_aes(...)
... |
comma-separated mappings of the form 'aesthetic=variable'. Available aesthetics for mapping are layer specific and are listed in the documentation for each layer type. Unavailable or unrecognized aesthetics are ignored. Variables must correspond to names in the layer's input data.frame, otherwise an error is thrown. |
This function replicates a subset of the functionality of the ggplot2 aes
function.
It does not allow for variable transformations or functions of multpile varuables.
These operations must be completed a priori by the user.
A list of aesthetic mappings.
ol_geom_polygon
,
ol_geom_line
,
ol_geom_point
,
ol_geom_icon
,
ol_geom_circle
polygon.matrix1 <- matrix( c( -80.385+c(0,0.05,0.05,0,0), 25.782618+c(0,0,0.05,0.05,0) ), ncol=2 ) polygon.matrix2 <- matrix( c( -80.34+c(0,0.05,0.025,0), 25.73++c(0,0,0.025*sqrt(3),0) ), ncol=2 ) polygon.list<-list(polygon.matrix1,polygon.matrix2) polygon.df <- data.frame(shape=c("rectangle","triangle"),no=c(1,2)) miami.OSM.basemap <- ol_map( center=c(-80.385790,25.782618), zoom=9 ) + streetmap() polygon.layer <- ol_geom_polygon( polygon.list, mapping=ol_aes( fill=no, lwd=shape ), df=polygon.df, name="Miami Polygons", toggle.control=TRUE, tooltip=polygon.df$no ) polygon.fill.scale <- ol_scale_fill_discrete( c("1"="red","2"="green"), opacity=0.5, display=TRUE, name="Number" ) polygon.linewidth.scale <- ol_scale_lwd_discrete( display=TRUE, name="Shape" ) polygons.over.miami <- miami.OSM.basemap + polygon.layer + polygon.fill.scale + polygon.linewidth.scale ## Not run: ol_map2HTML( polygons.over.miami, 'miami_polygons.html', map.heading="Miami Shapes", map.note="Note: Mouseover popup values are independent of shape size & color." ) browseURL("miami_polygons.html") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.