In streamtube plots, attributes inlcude
z, which set the coorindates of the vector field, and
w, which sets the x, y, and z components of the vector field. Additionally, you can use
starts to determine the streamtube's starting position. Lastly,
maxdisplayed determines the maximum segments displayed in a streamtube.
Basic Streamtube Plot
library(plotly) df = read.csv('https://raw.githubusercontent.com/plotly/datasets/master/streamtube-basic.csv') p <- df %>% plot_ly( type = 'streamtube', x = ~x, y = ~y, z = ~z, u = ~u, v = ~v, w = ~w, sizeref = 0.5, cmin = 0, cmax = 3 ) %>% layout( scene = list( camera = list( eye = list( x = -0.7243612458865182, y = 1.9269804254717962, z = 0.6704828299861716 ) ) ) ) p
Starting Position and Segments
library(plotly) df = read.csv('https://raw.githubusercontent.com/plotly/datasets/master/streamtube-wind.csv') p <- df %>% plot_ly( type = 'streamtube', x = ~x, y = ~y, z = ~z, u = ~u, v = ~v, w = ~w, starts = list( x = rep(80, 16), y = rep(c(20,30,40,50), 4), z = c(rep(0,4),rep(5,4),rep(10,4),rep(15,4)) ), sizeref = 0.3, showscale = F, maxdisplayed = 3000 ) %>% layout( scene = list( aspectratio = list( x = 2, y = 1, z = 0.3 ) ), margin = list( t = 20, b = 20, l = 20, r = 20 ) ) p
See our reference page for more information and chart attribute options!.