
From:  Doug Stewart 
Subject:  Re: Sliceomatic for Octave? Plotting "slices" of f(x, y, z) 
Date:  Sun, 6 Aug 2017 10:05:26 0400 
Anybody know where to find a tool like Sliceomatic
(https://www.mathworks.com/matlabcentral/fileexchange/ ) for764sliceomatic
Octave? Any help will be greatly appreciated. I couldn't find anything
similar on Google so yesterday afternoon I wrote some simple code for my
project to visualize "slices" of a function f(x, y, z) using scatter3.
The parameters of the 3d plotting function are the x, y, z, and f vectors,
and the number of slices n. The algorithm divides the max(f)  min(f)
interval into n  1 intervals, or "slices". Note that the term "slice" here
is different from that used in Sliceomatic. It then creates n subplots, one
per "slice", and assigns to each subplot only the values of f that fall
within the corresponding "slice".
Here are a few screenshots:
This is a 4slice plot of the normal distribution function f(x, y, z) =
exp((x^2 + y^2 + z^2)):
<http://octave.1599824.n4.nabble.com/file/n4684342/demo_ >normal.png
The rainbow color map was used, so blue and purple shades in the fourth
slice point to the local maximum.
This is 3slice plot of the "quadratic" function f(x, y, z) = x^2 + y^2 
z^2:
<http://octave.1599824.n4.nabble.com/file/n4684342/demo_ >multipit1.png
The red shades in the first slice indicate the proximity of one of the two
local minima.
The following two screenshots show the function f(x, y, z) = sin(x)/x +
sin(y)/y + sin(z)/z:
<http://octave.1599824.n4.nabble.com/file/n4684342/demo_ >multipit2_b.png
<http://octave.1599824.n4.nabble.com/file/n4684342/demo_ >multipit2_a.png
The second one is a "zoom in" of the first one where the x, y, and z axis
ranges are [5, 5] instead of [10, 10].
Here is the code of the first function to play with:


Here is the code of the myScatter3d function:


Feel free to change the number of colors (currently 512) and the color map
(currently "rainbow") as you like.
As I think that even a grade 6 could write this kind of code these days, the
code above is free to use as you see fit and in any kind of project,
commercial or noncommercial. Cheers!

View this message in context: http://octave.1599824.n4.nabble.com/Sliceomaticfor OctavePlottingslicesoffx yztp4684342.html
Sent from the Octave  General mailing list archive at Nabble.com.
_______________________________________________
Helpoctave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/helpoctave
[Prev in Thread]  Current Thread  [Next in Thread] 