Skip to content

Instantly share code, notes, and snippets.

@domitry
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domitry/9956747 to your computer and use it in GitHub Desktop.
Save domitry/9956747 to your computer and use it in GitHub Desktop.
3D Scatter demo with Plotrb
require 'plotrb'
values = []
for x in -5..5
for z in -5..5
values.push({x: x, y: (x*x+z*z)/5, z: z})
end
end
data = pdata.name('data').values(values)
mark = rect_mark.from(data)
vis = visualization.width(500).height(500) do
padding top: 10, left: 30, bottom: 30, right: 10
data data
marks mark
enable :Plot3D
end
vis.output_server("3D_scatter")

3D Scatter demo with Plotrb

alt text

Plotrb render 3D scatter like above (rendered function: y=x*x+z*z).
You can rotate and zoom it with your mouse.
My work is based on hlvoorhees's scatter plot demo. (gist here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment