[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A graphic I can (hardly) do in gnuplot, but not at all in octave
From: 
John W. Eaton 
Subject: 
A graphic I can (hardly) do in gnuplot, but not at all in octave 
Date: 
Tue, 2 Sep 1997 12:37:50 0500 
On 2Sep1997, Cautaerts Vincent <address@hidden> wrote:
 Hello,

 I need some help for creating a graphic. Actually, I can not do it
 easily under "gnuplot", but maybe there is a good way to do this kind
 of things. When doing it from gnuplot, I have to manually change
 the data file, which I cannot do everytime under octave !

 In brief, I make some simulations of pulses, and I would like to have
 something like this (let's try ASCII art...)

 y axis
 
  z axis
  / .
  / . . . * *
  / . *. *
  / ..... * . ...*............
  / * *
 /************** ************
 > x axis
 where *** is supposed to be one line, and .... another.

 If I use "mesh", I have a complete grid: i.e. also lines from some "*" to
 some "."

 Seen from the top of the y axis:
 WHAT I HAVE WHAT I'D LIKE z axis
 ++++++  
       
 ++++++  +> x axis
      
 ++++++ 
 ...

 If possible, I would like to have hidden lines, i.e.
 y axis
 
  z axis
  / .
  / . . . * *
  / . * *
  / ..... * *............
  / * *
 /************** ************
 > x axis

 Then, if somebody
 1) understands what I mean
 2) knows how to do it
 please tell me !

 When using mesh, I use the command:

 mesh(Memory_z',t',abs(Memory_v)');

 where "Memory_z" is for example a [1 5] vector, with the z coordinates
 of my pulses (thus 5 here)
 "t" is a [1 128] vector with the datas for the x axis
 "Memory_v" is a [5 128] vector with the datas:
 Memory_v(1,:) contains the first curve
 Memory_v(2,:) the second,...

 I'de like to plot, on a 3d graph, the curves
 Memory_v(1,:) versus t in the plane z=Memory_z(1) (represented with ** here)
 Memory_v(2,:) versus t in the plane z=memory_z(2) (represented with .. here)
 ...
I think gnuplot (and Octave) can almost do what you want. In Octave,
create a matrix that includes the lines you want to plot, like this:
data = [x1, y1, z1, x2, y2, z2, ..., xn, yn, zn];
where each x1, y1, z1, etc., represents a column of data. Then set
gnuplot's parametric plotting mode and plot the matrix using gsplot:
gset parametric
gsplot data
For example:
x = (0:0.2:6)';
n = length (x);
z = zeros (n, 3*n);
for i = [1:n2, n, n1]
z(:,3*i2) = x;
z(:,3*i1) = i;
z(:,3*i) = [sin(x(i:n)); sin(x(1:i1))];
endfor
gset parametric
gplot data
The problem is that if your data looks like it forms a grid (and this
matrix will), then gnuplot seems to want to draw the mesh lines. So
far, the only way I've found to turn this feature off involves editing
the generated data file, or by creating the data file for gnpulot
using fprintf. There may be a more convenient way, but I
haven't found it yet.
jwe