ggquiver | R package for quiver plots in 'ggplot2 | Data Visualization library
kandi X-RAY | ggquiver Summary
kandi X-RAY | ggquiver Summary
Quiver plots for ggplot2. An extension of ‘ggplot2’ to provide quiver plots to visualise vector fields. This functionality is implemented using a geom to produce a new graphical layer, which allows aesthetic options. This layer can be overlaid on a map to improve visualisation of mapped data.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ggquiver
ggquiver Key Features
ggquiver Examples and Code Snippets
library(ggplot2)
library(ggquiver)
expand.grid(x=seq(0,pi,pi/12), y=seq(0,pi,pi/12)) %>%
ggplot(aes(x=x,y=y,u=cos(x),v=sin(y))) +
geom_quiver()
ggplot(seals, aes(x=long, y=lat, u=delta_long, v=delta_lat)) +
geom_quiver(vecsize=0) +
bord
install.packages("ggquiver")
# install.packages("remotes")
remotes::install_github("mitchelloharawild/ggquiver")
Community Discussions
Trending Discussions on ggquiver
QUESTION
With ggquiver::geom_quiver()
we can plot vector fields, provided we know x
, y
, xend
, and yend
.
- How can I calculate these parameters for an arbitrary
RasterLayer
of elevations? - How can I ensure that the size of these arrows indicates the slope for that particular vector such that the arrows appear different lengths proportional to the gradient at that location (e.g., the first plot below)?
ANSWER
Answered 2020-May-13 at 13:05Effectively what you're asking is to convert a 2D scalar field into a vector field. There are a few different ways to do this.
The raster package contains the function terrain
, which creates new raster layers that will give you both the angle of your desired vector at each point (i.e. the aspect), and its magnitude (the slope). We can use a little trigonometry to convert these into the North-South and East-West basis vectors used by ggquiver
and add them to our original raster before turning the whole thing into a data frame.*
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ggquiver
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page