View source: R/vector_fields.R
| vc_plot_vector_field | R Documentation |
Display stored field arrows and an optional trajectory
vc_plot_vector_field(result, streamline = NULL, scale = NULL, title = NULL)
result |
Result of vc_vector_field_sample(). |
streamline |
Optional vc_streamline() result. |
scale |
Positive maximum arrow length in Cartesian units. By default uses eight percent of the largest sampled axis span. |
title |
Optional plot title. |
Plotly widget using stored positions and vectors. Arrow lengths are proportional to magnitude and zero vectors are shown as points.
if (requireNamespace("plotly",quietly=TRUE)) {
f <- function(p)c(-p[2],p[1],0)
s <- vc_vector_field_sample(f,function(x)-1,function(x)1,
function(p)0,function(p)0,c(-1,1),n=4,n_u=4,n_v=1)
vc_plot_vector_field(s,vc_streamline(f,c(1,0,0),c(0,pi)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.