[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plotting a function of 3 variables ?
From: |
Mike Miller |
Subject: |
Re: Plotting a function of 3 variables ? |
Date: |
Wed, 25 Apr 2012 15:05:48 -0400 |
On Wed, Apr 25, 2012 at 1:00 PM, Martin Helm <address@hidden> wrote:
> Oisin found meanwhile that scatter3 does what he want
>
> [x,y,z] = meshgrid(-10:1:10,-5:1:5,-8:2:8);
> % this creates x,y and z 3-D arrays, x contains -10:1:10 replicated
> length(-5:1:5)xlength(-8:2:8) times, y contains -5:1;5 replicated .....
> c = x.^2+y.^2+z.^2;
> % c is now our function of 3 variables
> figure
> scatter3(x(:),y(:),z(:),5,c(:),'filled')
>
> which gives the attached result with fltk but does not work with gnuplot.
>
> Anyone has an idea if that can somehow work with gnuplot as well?
This is the error I get with gnuplot, same for you?
error: invalid value for color property "markerfacecolor"
error: called from:
error: /usr/share/octave/3.6.1/m/plot/private/__scatter__.m at line
274, column 11
error: /usr/share/octave/3.6.1/m/plot/private/__scatter__.m at line
211, column 13
error: /usr/share/octave/3.6.1/m/plot/scatter3.m at line 68, column 11
I got this example to work with gnuplot using the following:
cmap = colormap ();
colors = cmap (fix (c(:).*(rows(cmap)-1)./max(c(:))) + 1, :);
scatter3(x(:), y(:), z(:), 20, colors, 'filled');
Marker size 5 is invisible to me in gnuplot so I bumped it up to 20.
> Otherwise I file a bug.
Yes, please do.
--
mike
Re: Plotting a function of 3 variables ?, Martin Helm, 2012/04/25