Back to draw-VTK

'draw'-VTK interface:
Multiplots


Once you have opened a Maxima session, load package draw and then set global variable draw_renderer to vtk:

load("draw") $
draw_renderer: 'vtk $

Plotting four scenes. It's possible to drag the pointer and move each scene independently in the interacting window. The function to be called is draw, each argument gr3d defines a 3D scene. Option columns is used to arange scenes in two columns:

draw(
    columns = 2,

    gr3d(
      nticks     = 100,
      line_type  = tube,
      parametric(t*cos(t^2),t*sin(t^2),t^2,t,0,%pi),
      enhanced3d = true,
      transform  = [x+5, y+5, z+5, x, y, z],
      parametric(t*cos(t^2),t*sin(t^2),t^2,t,0,%pi) ),

    gr3d(
        background_color = green,
        enhanced3d       = [y,x,y,z],
        point_size       = 2/3,
        point_type       = cube,
        palette          = [5,12,-3],
        points_joined    = true,
        points([[0,0,-5], [1,1,1], [2,2,2]]) ),

    gr3d(
        background_color = navy,
        color=yellow,
        explicit(x^2+y^2,x,-1,1,y,-1,1) ),

    gr3d(
        background_color = cyan,
        xu_grid          = 100,
        yv_grid          = 25,
        color            = white,
        view             = [100,20],
        parametric_surface(0.5*u*cos(u)*(cos(v)+1),
                           0.5*u*sin(u)*(cos(v)+1),
                           u*sin(v) - ((u+3)/8*%pi)^2 - 20,
                           u, 0, 13*%pi, v, -%pi, %pi))   )$
multiplot1

With option allocation scenes can be arbitrary placed on the window. If allocation is not used, automatic allocation is controlled by option columns:

draw(

  gr3d(
    allocation = [[0,0.75],[1,0.25]],
    background_color = green,
    color      = cyan,
    head_angle = 10,
    line_width  = 0.1,
    vector([0,1,0],[-10,0,0])),

  gr3d(
    allocation = [[0,0],[1,0.75]],
    background_color = white,
    color   = "#abc80e",
    cone([0,0,0],1,1,[0,2,1]),
    color   = red,
    opacity = 1/3,  
    cone([0,0,0],1,1,[0,-2,-1])) )  $
multiplot2

The first scene is placed automatically filling the whole window. The second scene is placed with option allocation above the first one:

draw(
  gr3d(
    enhanced3d       = sin(u)+cos(v),
    background_color = yellow,
    palette          = [8,4,3],
    parametric_surface(
      sin(u)+.5*sin(u)*cos(v),
      .5*sin(v),
      cos(u)+.5*cos(u)*cos(v),
      u, -%pi, %pi,
      v, -%pi, %pi)),
  gr3d(
    allocation       = [[0.6,0.6],[0.4,0.4]],
    background_color = cyan,
    points_joined = true,
    point_type    = dot,
    enhanced3d    = true,
    line_width    = 0.05,
    line_type     = tube,
    points([[0,0,0], [1,1,1]]) ) ) $
multiplot3

2D scenes are defined with gr2d:

draw(
  dimensions = [250,500],
  columns = 1,

  gr2d(
    background_color = yellow,
    explicit(x^2, x, -1, 1)),

  gr3d(
    cone([0,0,0],1,1,[0,2,1]))) $
multiplot4

Two and three dimensions overlapping scenes:

draw(
  gr3d(
    cone([0,0,0],1,1,[0,2,1])),

  gr2d(
    allocation       = [[0.6,0.6], [0.4,0.4]],
    background_color = yellow,
    explicit(x^2, x, -1, 1)) ) $
multiplot5

Two 2D scenes:

draw(
  gr2d(
    background_color = red,
    line_width       = 3,
    line_type        = dashes,
    explicit(x^3,x,-1,1)),
    
  gr2d(
    background_color = yellow,
    color            = salmon,
    line_width       = 5,
    line_type        = solid,
    explicit(x^2,x,-1,1),
    color            = black,
    line_width       = 1,
    explicit(sin(x), x, 0, 10)) ) $
multiplot6

© 2016, TecnoStats.