Menu

#1593 splot matrix with dm3d, interpolate and dgrid3d do not scale right!

None
closed-invalid
nobody
None
2015-08-02
2015-04-14
Martin Drab
No

With for instance the following testing data matrix file "test.dat":


1 1 1 1 1
1 2 1 2 1
2 1 8 1 2
1 2 1 2 1
1 1 1 1 1


The following script:


reset
set view map
set pm3d interpolate 0,0
set dgrid3d 100,100 gauss
splot "test.dat" using ($14):($24):3 matrix w pm3d


creates a wrong interpolation of the input data. It should just be a scaled version
of the following:


reset
set view map
set pm3d interpolate 0,0
set dgrid3d 100,100 gauss
splot "test.dat" using 1:2:3 matrix w pm3d


but it obviously isn't.

Fails on all versions up until and including todays CVS snapshot. (Specifically tested on 4.4 patchlevel 3 from CentOS 6, 5.0 patchlevel 0 from Gentoo, and latest CVS from April 14, 2015, all on Linux, but I do not think it to be system dependent.)

Attached are both the testing data and scripts nad resulting png images to compare.

5 Attachments

Discussion

  • Martin Drab

    Martin Drab - 2015-04-14

    OK, the text formatting got the example displayed wrong (and I did a typo, but the attached scripts are correct). The line should better be like this:

    splot "test.dat" matrix using ($1 * 4):($2 * 4):3 w pm3d

    while the correctly resulting line should be:

    splot "test.dat" matrix using 1:2:3 w pm3d

     
  • Martin Drab

    Martin Drab - 2015-04-14

    It seems the scaling does not honor the interpolation, which is quite unfortunate.

     
  • Martin Drab

    Martin Drab - 2015-04-14

    The same problem can be invoked by simply interpolating a nonuniform matrix even without scaling and that is also quite an unexpected behaviour.

    E.g. when transcribing the original example to nonuniform matrix "test2.dat":


    5 0 4 8 12 16
    0 1 1 1 1 1
    4 1 2 1 2 1
    8 2 1 8 1 2
    12 1 2 1 2 1
    16 1 1 1 1 1


    then the following script also produces the wrong image:


    reset
    set view map
    set pm3d interpolate 0,0
    set dgrid3d 100,100 gauss
    splot "test2.dat" nonuniform matrix w pm3d


    Example data, script and image also appended.

     
  • Martin Drab

    Martin Drab - 2015-04-14

    OK, after poking around a little, it may seem, that the problem is probably in that the gauss (or any other for that matter) kernel is applied in the original size to the enhanced interpolation mesh, which makes the kernel smaller in comparison and thus not interpolating as one would originally thought. Is this intentional or is is a bug? And if it really is a feature, I suppose it would be worth introducing some optional parameter (which I think may even be on by default) to make the kernel scale with the mesh enhancement, so that it is proportional to the originam matrix, which I think is what the user would expect.

    Any opinions on this?

     
  • Hans-Bernhard Broeker

    • labels: pm3d, interpolate, splot, dgrid3d, matrix -->
    • status: open --> closed-invalid
    • Group: -->
    • Priority: -->
     
  • Hans-Bernhard Broeker

    A single RTFM would have made it clear that your expectations are in conflict with the documentation. The documentation is sufficiently clear that all dgrid3d kernels operate in actual data coordinates. So when you rescale the data, you get a different result. The kernel is scaled in original matrix size. But you changed the original matrix size.

     

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.