2
$\begingroup$

I have a dataset and would not want Mathematica to interpolate at all while plotting the contours. This is because the data contains essential binning information and the "steps" in the contour must convey that sense. Interpolating on the data to "smoothen" the contours would make the plot lose its physical validity altogether. Apparently, ListContourPlot doesn't show the contour lines at all when InterpolationOrder is set to 0.

ListContourPlot[data, ScalingFunctions -> {"Log", "Log", "Log"}, 
 InterpolationOrder -> 0, Contours -> {Log[3]}, 
 ContourShading -> {None, GrayLevel[0.5, 0.36]}, 
 GridLines -> {{0.001, 0.01, 0.1, 1}, {5*10^-4, 10^-3, 2*10^-3, 5*10^-3}}, 
 ContourStyle -> {Thick,  Black}]

With just the InterpolationOrder commented out the contour lines do appear.

 ListContourPlot[data, ScalingFunctions -> {"Log", "Log", "Log"}, 
     (*InterpolationOrder -> 0,*) Contours -> {Log[3]}, 
     ContourShading -> {None, GrayLevel[0.5, 0.36]}, 
     GridLines -> {{0.001, 0.01, 0.1, 1}, {5*10^-4, 10^-3, 2*10^-3, 5*10^-3}}, 
     ContourStyle -> {Thick,  Black}]

What I want is that neither of the regions be shaded but the contour line appear. Which I believed I should get with the code,

ListContourPlot[data, ScalingFunctions -> {"Log", "Log", "Log"}, 
     InterpolationOrder -> 0, Contours -> {Log[3]}, 
     ContourShading -> None, 
     GridLines -> {{0.001, 0.01, 0.1, 1}, {5*10^-4, 10^-3, 2*10^-3, 5*10^-3}}, 
     ContourStyle -> {Thick,  Black}]

But this gives me just nothing. A blank plot.

A sample dataset may be obtained using,

 data = List[{10^-4, 10^-3, Abs[-0.5*Log[10^-4/10^-3]]}];
Do[
  Do[
   test = Abs[-0.5*Log[i/j]];
   data = Join[data, List[{i, j, test}]],
   {i, 10^-4, 10^-2, 10^-3}],
  {j, 10^-3, 6, 10^-1}];

Update:

@kglr it doesn't work. With the sample data, what I would require is the line between the two regions in

What I get using

if=Interpolation[DeleteDuplicates@data, InterpolationOrder->0]; Quiet@ContourPlot[if[x,y],{x,0,1},{y,0,6},ScalingFunctions->{"Log","Log","Log"}, Contours->{{Log[3]}}, ContourStyle->Directive[Thick, Black],ContourShading->None]

is

Even the scales don't match up somehow.

$\endgroup$
  • 2
    $\begingroup$ Can you please provide a minimal representative data? $\endgroup$ – rhermans Jul 25 '18 at 7:29
  • $\begingroup$ Right, dataset to play with would be great. Sound as if something like ArrayMesh[ UnitStep[threshold - data]] could be useful here. $\endgroup$ – Henrik Schumacher Jul 25 '18 at 7:49
  • $\begingroup$ is this close to what you need: if=Interpolation[DeleteDuplicates@data, InterpolationOrder->0]; Quiet@ContourPlot[if[x,y],{x,0,1},{y,0,6},ScalingFunctions->{"Log","Log","Log"}, Contours->{{Log[2]}}, ContourStyle->Directive[Thick, Black],ContourShading->None]? $\endgroup$ – kglr Jul 25 '18 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.