|
From: Andy M. <and...@gm...> - 2007-06-15 21:50:07
|
Hello, I need a little help with a plot I am trying to produce. It is driving me crazy! I'm keep thinking it is possible, but I'm not completely sure. So I have this particular function I am trying to plot. I generate data in the form (shorthand notation for my own ease): s = 1:10 p = 1:30 [x,y,z] = f(s,p) and I can fill up matricies any way I like to store the results. I want to plot this ribbon is 3d space, I decided I didn't want to be able to distinguish the s part (just leave that as a row), and have p denoted by a change in colour. So this surface twists like a ribbon, starting at red, and finishing blue (or whatever) What I did is create two data files, one for the surface position data in the form: x(s=1,p=1) y(s=1,p=1) z(s=1,p=1) x(s=2,p=1) y(s=2,p=1) z(s=2,p=1) x(s=3,p=1) y(s=3,p=1) z(s=3,p=1) x(s=4,p=1) y(s=4,p=1) z(s=4,p=1) x(s=1,p=2) y(s=1,p=2) z(s=1,p=2) x(s=2,p=2) y(s=2,p=2) z(s=2,p=2) x(s=3,p=2) y(s=3,p=2) z(s=3,p=2) x(s=4,p=2) y(s=4,p=2) z(s=4,p=2) etc and another one the same for the colour data, but with the z column replaced by p I then get extremely stuck trying to plot this using splot with pm3d. Am I fighting a losing battle? Or can someone help? Thanks, Andy. |
|
From: <HBB...@t-...> - 2007-06-15 22:40:21
|
Andy Main wrote: > What I did is create two data files, one for the surface position data > in the form: [...] > and another one the same for the colour data, but with the z column > replaced by p That was the wrong idea. You should just have put the 'p' (and 's') column in the same file as x, y and z. gnuplot can pick any three or four columns out of a multi-column data file and use them as plot coordinates. Read 'help datafile', 'help pm3d' and 'help splot using' thoroughly, and you should be able to figure out how to get the plot you need. Pay particular attention to the concept of grid data. |
|
From: Andy M. <and...@gm...> - 2007-06-15 22:45:47
|
On 6/15/07, Hans-Bernhard Br=F6ker <HBB...@t-...> wrote: > Andy Main wrote: > > > What I did is create two data files, one for the surface position data > > in the form: > [...] > > and another one the same for the colour data, but with the z column > > replaced by p > > That was the wrong idea. You should just have put the 'p' (and 's') > column in the same file as x, y and z. gnuplot can pick any three or > four columns out of a multi-column data file and use them as plot > coordinates. > > Read 'help datafile', 'help pm3d' and 'help splot using' thoroughly, and > you should be able to figure out how to get the plot you need. Pay > particular attention to the concept of grid data. > Yes, I was just in the process of posting back to the list. I thought I read that the data needed to be in triples, but a nice coffee fixed this for me. Its amazing how you can tie yourself in knots for no reason! Thanks for your help, Andy. |
|
From: Andy M. <and...@gm...> - 2007-06-20 00:28:48
|
Actually I'm not sure if the plots are coming out correctly. I thought they were, but looking at the data there is a particular segment that doesn't plot correctly. I don't really want to list the full data so I'll try to abbreviate... a whole load of segments like this (where my data is constant)... 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 1.000000 1.000000 then.. 1.000000 0.004990 0.990020 1.100000 1.000000 0.008982 0.982040 1.100000 1.000000 0.014970 0.970060 1.100000 1.000000 0.019960 0.960080 1.100000 1.000000 0.024950 0.950100 1.100000 1.000000 0.029940 0.940120 1.100000 1.000000 0.034930 0.930140 1.100000 1.000000 0.039920 0.920160 1.100000 1.000000 0.044910 0.910180 1.100000 1.000000 0.048902 0.902200 1.100000 1.000000 0.008982 0.982040 1.200000 1.000000 0.019960 0.960080 1.200000 1.000000 0.029940 0.940120 1.200000 1.000000 0.039920 0.920160 1.200000 1.000000 0.048902 0.902200 1.200000 1.000000 0.059880 0.880240 1.200000 1.000000 0.069860 0.860280 1.200000 1.000000 0.079840 0.840320 1.200000 1.000000 0.089820 0.820360 1.200000 1.000000 0.099800 0.800400 1.200000 etc. the 'x' value doesn't change till a bit later. (so at the moment the surface is moving purely in the yz plane) It seems as though none of this data gets plotted until the x axis starts moving. Now, I'm sorry if I get a little confused reading the documentation but I end up getting a little lost. It does warn me about doing this, but just mentions care should be taken. Is this a fundemental problem/limit with Gnuplot? The xyz data is generated by a function (the 4th column with a hidden 5th variable - generating the 10 lines), so I can't guarentee the scaling or anything. Hope someone with a bit more experiance can walk me through this one... Thanks, Andy. > On 6/15/07, Hans-Bernhard Br=F6ker wrote: > > Andy Main wrote: > > > > > What I did is create two data files, one for the surface position dat= a > > > in the form: > > [...] > > > and another one the same for the colour data, but with the z column > > > replaced by p > > > > That was the wrong idea. You should just have put the 'p' (and 's') > > column in the same file as x, y and z. gnuplot can pick any three or > > four columns out of a multi-column data file and use them as plot > > coordinates. > > > > Read 'help datafile', 'help pm3d' and 'help splot using' thoroughly, an= d > > you should be able to figure out how to get the plot you need. Pay > > particular attention to the concept of grid data. > > > > Yes, I was just in the process of posting back to the list. I thought > I read that the data needed to be in triples, but a nice coffee fixed > this for me. Its amazing how you can tie yourself in knots for no > reason! > > Thanks for your help, > > Andy. > |
|
From: <HBB...@t-...> - 2007-06-20 18:05:27
|
Andy Main wrote: > Actually I'm not sure if the plots are coming out correctly. I > thought they were, but looking at the data there is a particular > segment that doesn't plot correctly. [...] > the 'x' value doesn't change till a bit later. (so at the moment the > surface is moving purely in the yz plane) It seems as though none of > this data gets plotted until the x axis starts moving. You'll have to be more precise on the description of the problem. What does it mean to "not plot correctly", and _how_ exactly does it "seem [not to] get plotted"? > Now, I'm sorry if I get a little confused reading the documentation > but I end up getting a little lost. It does warn me about doing this, Where "this" is ... what? |