Interpolation fails for elongated data

Consider a regular but unstructured array of points on a rectangular domain of arbitrary aspect ratio. In this example, the domain can be scaled along the x and y axes by the input arguments:

dataZ = RandomReal[{1, 5}, {10, 10}];
scaleTheDomainBy10To[bx_, by_] := Module[{},
    data = Flatten[Table[{x*10^(bx - 1), y*10^(by - 1), dataZ[[x, y]]}
                         , {x, 1, 10}, {y, 1, 10}],  1];
    Show[
        ListContourPlot[data, ImageSize -> 250, PlotLabel -> {bx, by}],
        ListPlot@Map[#[[{1, 2}]] &, data]
        ]
];

In v10 on Win7, When the aspect ratio of the domain approaches ~10^4, the interpolation methods inside ListContourPlot start to break down:

Grid[{{scaleTheDomainBy10To[3, 0], scaleTheDomainBy10To[3.5, 0], scaleTheDomainBy10To[4, 0]},
      {scaleTheDomainBy10To[0, -3], scaleTheDomainBy10To[0, -3.5], scaleTheDomainBy10To[0, -4]}}]

GrAsa Interpolation fails for elongated data

I tried scaling the domain and then applying DataRange inside ListContourPlot, but apparently ListContourPlot scales the data before doing its thing, which seems rather counterproductive.

My current workaround is to scale the domain, construct an Interpolation object of order 1, then call ContourPlot on that object using explicitly scaled input arguments.

However, I am not happy with that solution because the domain of my actual data is slightly ragged, which means to prevent Mathematica from showing the regions where the interpolation object is garbage, I have to set explicit boundaries for the plot region, either using

ContourPlot[..., {x,1.1,9.9},{y,1100,9900}]

or using RegionFunction, which is slow and requires a hefty amount of manual twiddling to get the region right. One nice feature of ListContourPlot is that it usually seems to truncate the plot region to the Delaunay “hull” of the input data, which is a feature I’d like to keep using. (Anyone know if this is indeed what it is doing?)

Is there a way I can tell ListContourPlot what numerical precision to use when constructing the interpolation? I would have expected the algorithm to fail for aspect ratios approaching machine precision, not 10^4. If this can be done, all the other problems seem be handled elegantly inside ListContourPlot.

I am not really interested in trying to regularize or smooth my data, as some of the raggedness is crucial for interpretation.

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.
Want something else to read? How about ‘Grievous Censorship’ By The Guardian: Israel, Gaza And The Termination Of Nafeez Ahmed’s Blog

Recent Questions – Mathematica Stack Exchange