Menu

#171 pm3d interpolate gives changing results

closed-out-of-date
nobody
None
2
2008-01-11
2007-02-13
No

I still work with pm3d on non grid data.

Using pm3d on grid data and afterwards choosing a
non grid subset of the data for plotting, results in
different color maps not only close to border (where
it would be acceptable) but also inside the area,
where all data points are as before!!

I attached a zip with all data and plt-file to
demonstrate.

I think it is necessary to optimise the interpolation
module of pm3d.

Discussion

1 2 > >> (Page 1 of 2)
  • Michael Hecht

    Michael Hecht - 2007-02-13

    Complete Data and Plt-File for demonstration

     
  • Petr Mikulik

    Petr Mikulik - 2007-02-13

    Logged In: YES
    user_id=31505
    Originator: NO

    Please use the *smallest* number of commands and the of the datafile that can reproduce your problem.

    Trying your example, I believe you see different palettes because you look to different corners of your notebook at different angles.

     
  • Michael Hecht

    Michael Hecht - 2007-02-14

    Logged In: YES
    user_id=1701062
    Originator: YES

    What I attached was the output of the gnuplot save command.
    Here is the necessery extract from history:

    set view map
    set palette rgb 33,13,10
    se yrange[10:40]
    se xrange[10:60]
    se cbrange[0:0.5]
    set pm3d map interpolate 20,20 ftriangles flush center
    splot "coregrid.txt","incohu.txt" ,"grahamhull.txt" w l

     
  • Petr Mikulik

    Petr Mikulik - 2007-02-14

    Logged In: YES
    user_id=31505
    Originator: NO

    Yes, I've got that by gpsavediff. But it's better to have it by hand.

    Your data files are big. I don't see any difference for interpolate 20,20 vs interpolate 1,1. I've only seen different images when the graph windows appeared in different corners of my notebook.

     
  • Michael Hecht

    Michael Hecht - 2007-02-14
     
  • Michael Hecht

    Michael Hecht - 2007-02-14

    Logged In: YES
    user_id=1701062
    Originator: YES

    Hmmm, I'm not totally sure whether we talk about the same thing.

    Point 1: There is a big difference in interpolate 1,1 vs. interpolate 20,20
    I attached a figure where you can see the difference of a subsection.
    Point 2: The different maps of the subsection of data compared to the full grid
    is obvious in my opinion. To demonstrate this I attached also an example.
    Even if in a large scale all seems to be comparable, in a fine scale there
    are serious differences.
    Maybe it is only a problem of the windows version of gp??
    File Added: interpolate.jpg

     
  • Petr Mikulik

    Petr Mikulik - 2007-02-14

    Logged In: YES
    user_id=31505
    Originator: NO

    interpolate of pm3d is a local method (=only 4 pts taken into account) to calculate new point values.
    gridding works globally (=all data points), given a weight function, see 'help dgrid3d'.
    Thus colors of a given point in the drawn area should be different.

    If it is still not the thing you talk about, please try to demonstrate the problem on a data file with just few points, not as cloudy as the current one.

     
  • Michael Hecht

    Michael Hecht - 2007-02-14
     
  • Michael Hecht

    Michael Hecht - 2007-02-14

    Logged In: YES
    user_id=1701062
    Originator: YES

    Ok, I think we come closer to my problem. :-)
    You agree if I say both plots are locally different, do you?

    The rectangular plot I added in the first attachement and the "hand cut" figure of the second attachement (on the middle left) are not produced using dgrid3d, but are from the data set I added first ("coregrid.txt").
    So both data sets are the same, except that I took away some points in the data set "incohu.txt" and slightly modified the boundary points. The inner points are all exacly the same in both data sets.
    Both data sets were plotted using "set pm3d map interpolate 20,20 ftriangles flush center".

    So the question is:
    If "pm3d interpolate" works locally using 4 points, how do you select the points and is there a difference in selection if the grid is not rectangular (I think: YES)? This seems to be the core problem / task to solve!

    Furthermore the following is interesting:
    I added a file "incohu_NaN.txt" where I didn't remove the outer points but set them to NaN. Now the inner points are interpolated exacly as in the original full file ("coregrid.txt"). But unfortunately the boundary doesn't look acceptable, otherwise I could use this solution.
    Maybe the NaN points should be handled other than the current solution, i.e. the outer shape of non NaN points completely filled like using the file "incohu.txt" but the coloring like in "incohu_NaN.txt"? There could be an option to the pm3d command forcing the NaN points not to be drawn but to be used for the selection of the point-quadruple.

    File Added: incohu_NaN.txt

     
  • Petr Mikulik

    Petr Mikulik - 2007-02-14

    Logged In: YES
    user_id=31505
    Originator: NO

    Yes, there are local differences...

    Please try also
    set autoscale fix
    splot '....' u 1:2:3

    And don't use "pm3d interpolate". Can you see a difference?

    Now, please replace you big file with >7000 points with a simple data file with just few, e.g. 5x5 points, and try to reproduce your problem.

     
  • Michael Hecht

    Michael Hecht - 2007-02-15

    Logged In: YES
    user_id=1701062
    Originator: YES

    Even if I think the reason for the mis-interpolation is now clear I try to extract a smaller subset of data which can reproduce the behaviour.

    Meanwhile you can maybe think about the following:
    If I take the full grid (even if x and y are partially shifted) file "incohu_NaN.txt" and plot it with
    splot "incohu_NaN.txt"
    I get the result as it should be (except the boundaries). Plotting the same file with
    splot "incohu_NaN.txt" us 1:2:3
    I get a wrong interpolation, but it seems to be exactly the same as using the file "incohu.txt". So there seems to be a pattern behind the mis-behaviour.

     
  • Michael Hecht

    Michael Hecht - 2007-02-15

    Logged In: YES
    user_id=1701062
    Originator: YES

    Ok, now I generated a reduced file called "incohu_NaN_red.txt".
    You can plot this with
    set pm3d map interpolate 10,10 ftriangle flush center
    set view map

    1. splot "incohu_NaN_red.txt"
    2. splot "incohu_NaN_red.txt" us 1:2:3

    and you will see changing interpolation results.

    In case 1. I get: Right interpolation, non-smooth edges
    In case 2. I get: Wrong interpolation, smooth edges

    I tried to reproduce it at the upper x-End of the drawing, so that the data START with a rectanglar shape on the lower left and END with a non-grid shape on the RIGHT, but all was ok and there was no error.

    By choosing the left side of the data set, where data START with a non-rectangular shape (and end on the RIGHT with a rectangular grid) I get the false interpolation!!

    Obviously if data start on lower left with a rectangular grid all is ok, but if data start with a non-rectangular grid, there is a mis-alignment for the point-quadruple used for interpolation.

    File Added: incohu_NaN_red.txt

     
  • Michael Hecht

    Michael Hecht - 2007-02-15
     
  • Michael Hecht

    Michael Hecht - 2007-02-15

    Logged In: YES
    user_id=1701062
    Originator: YES

    I produced meanwhile a figure which might explain the problem finally.

    The right part of the figure shows the desired interpolation, but problems with non-filled triangles near the edges. The right figure doesn't fill the the free triangles in a "natural" way but shows a mis-alignement which remains throughout the entire drawing (using the non-reduced data set "incohu_NaN.txt" or the original one "incohu.txt").

    This is the reason for all of my problems :-)

    Dear Petr, I hope this is enough information to fix the problem!!!

    File Added: pm3dinterpolate.jpg

     
  • Michael Hecht

    Michael Hecht - 2007-02-15
     
  • Michael Hecht

    Michael Hecht - 2007-02-15

    Logged In: YES
    user_id=1701062
    Originator: YES

    In my last message I wanted to write: "... The LEFT part of the figure shows the desired interpolation ...".
    Sometimes I should spend more concentration on reading what I wrote.

    Furthermore, on the left figure there is at least one field at x=28 and y~19.7 which is also not exacly drawn.

    Finally I'm really interested in the difference between "splot 'foo'" and "splot 'foo' us 1:2:3", since if no columns are specified there is no other chance than using 1:2:3 for plotting, is it?

     
  • Michael Hecht

    Michael Hecht - 2007-02-15

    Logged In: YES
    user_id=1701062
    Originator: YES

    To show what I want to get I changed one of the figures in "pm3dinterpolate.jpg" by hand.

    The result is attached as "pm3dOptimum.jpg". Maybe this helps.
    File Added: pm3dOptimum.jpg

     
  • Michael Hecht

    Michael Hecht - 2007-02-15
     
  • Michael Hecht

    Michael Hecht - 2007-02-15

    Logged In: YES
    user_id=1701062
    Originator: YES

    While waiting for an answer I was quite busy. I downloaded the current new rc4 (so I have one from January and one from February???? Why the new one isn't rc5???)

    Furthermore I recognised, that setting "set datafile missing 'NaN'" makes the behaviour consistent, i.e. now the drawing for the file "incohu_NaN.txt" is always the same (see attached file "missingNaN.jpg", grid points additionally visualised) and doesn't change with "using".

    But now it is no longer possible to simulate the mis-interpolation in the file "incohu.txt" using "incohu_NaN.txt". Nevertheless, I think there are enough examples to understand what was and is my problem (I hope)!!

    File Added: missingNaN.jpg

     
  • Michael Hecht

    Michael Hecht - 2007-02-15
     
  • Michael Hecht

    Michael Hecht - 2007-02-15

    Logged In: YES
    user_id=1701062
    Originator: YES

    Juhu ... this is German and means something like "Hooray", "Yippee" ...

    I found something you can call a "workaround", which is applicable for me but surely not for other gnuplot users.
    To solve my problem I combined both data files, i.e. "incohu.txt" where all data outside the convex hull are removed and the file "incohu_NaN.txt" where all data outside the convex hull were set to "NaN".
    The first file always results in wrong interpolation using "pm3d interpolate" and the second one always produces non-smooth borders regardless of use of "ftriangles". The only job to do for me is now to plot both files simultaneously. This smoothes the borders of the right interpolated plot by something which is optically acceptable, resulting in smooth borders and right interpolation. I added the final result as jpeg.

    Nevertheless: I imploringly hope that Petr will go on and try to fix the undesired behaviour of pm3d interpolate.
    File Added: workaround.jpg

     
  • Michael Hecht

    Michael Hecht - 2007-02-15
     
  • Petr Mikulik

    Petr Mikulik - 2007-02-15

    Logged In: YES
    user_id=31505
    Originator: NO

    Please do really concentrate what you want to submit. If you don't describe the things clearly, that's no direct way to help you.

    > While waiting for an answer I was quite busy. I downloaded the current
    > new rc4 (so I have one from January and one from February???? Why the
    > new one isn't rc5???)

    No idea what you talk about.

    Now you seem to be mixing "set missing", "using <options>" etc. These have (almost) nothing to do with "pm3d interpolate".

    Sorry, but I cannot do anything with your issue of "pm3d interpolate", it's too much confused with other things. If you wish I have a look at the matter, please prepare a *simple* and *small* data file, with size e.g. 5x5, and a script with just few commands like
    set pm3d {interpolate 2,2}
    set autoscale fix
    splot 'small.dat' u 1:2:3

     
  • Michael Hecht

    Michael Hecht - 2007-02-16
    • priority: 5 --> 2
     
  • Petr Mikulik

    Petr Mikulik - 2007-02-16

    Logged In: YES
    user_id=31505
    Originator: NO

    Well, you have submitted your data file and tried to explain the problem. You have finally claimed that the problem is "Everytime if I got the right interpolation the borders of the figure were not smooth. Everytime if I got smooth borders the interpolation was wrong." I wish to find a really small file where we could demonstrate the problem. I hope you wish so. I'm not able to do it from your large data file, sorry.

    I did tried to find a small demonstration, but I couldn't see any problem. You have a good knowledge of your problem, so please try to find such a demo.

    The other part of your description, i.e. using "set missing", "splot ..." vs "splot ...using" are all documented behaviour (see "help missing", for example).

    > I checked whether there is a new gnuplot version available and found out that
    > there are different versions of the same release candidate which I think is
    > confusing.

    Aha, you are using the windows binary, not the source code. Then, please look to "README.Windows", where you find on the 1st two lines:

    This is gnuplot version 4.2 RELEASE CANDIDATE RC4 as of 10.2.2007
    This is gnuplot version 4.2 -- binary distribution for MS-Windows 32bit

    and there is also the ChangeLog file.

    Please notice that it was me who compiled this version, even though I use Linux, and I did it so that Windows users without experience in compiling the source code can profit from the up-to-date gnuplot distribution. You are welcome to contribute to improve whatever you think that should be improved!

    > It's your task to recognise and fix this, not my.
    > I thought you are always interrested in improving gnuplot to the best possible behaviour.

    Hm, only the latter. But I can fix only what I can see and can reproduce!

    > This really gets me irritated.
    Then you give up, or be brave and find the solution! Yes, sometimes it is really tough...

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.