1
$\begingroup$

Question

I have generated two data sets using Outer and Subdivide commands. Both use similar boundaries except the second dataset uses a higher bound for the 'y' axes. Now, I have decided to plot the two datasets using a ListContourPlot and overlay a set of gridlines to visualize a region of interest. I have expected both regions to look the same. However, this wasn't the case. I have also noticed inconsistency in the isopleths. For example, I would expect ~ 10^6 * .4 to be in green area. Instead, it is way above isopleth visualizing 500k$. I am sure I have misused the function in some way, and I would appreciate if somebody could shed some light on the subject.

Please note, I did manage to fix the issue by increasing the amount of elements generated by the Subdivide command from 4 to 100. Put in a Log10 scale using the new data, the regions also retained similarity. However, messing around with the Subdivide did affect the isopleths and the region of interest making them look different.

Plots

enter image description here

Code

data1 = Outer[{#1, #2, #1*#2} &, Subdivide[.02, 1, 4], Subdivide[10^4, 10^7, 4]] // Flatten[#, 1] &;
data2 = Outer[{#1, #2, #1*#2} &, Subdivide[.02, 1, 4], Subdivide[10^4, 2*10^7, 4]] // Flatten[#, 1] &;

colors2 = {"#a3d977", "#ffeca9", "#ffdf71" , "#ff8f80"};

x = ListContourPlot[
   (* Data Specification *)
   data1
   
   (* General Configuration *)
   , Frame -> True
   , ImageSize -> Medium
   , PlotRangeClipping -> False
   , ScalingFunctions -> {None, "Log10"}
   
   (* Contour Configuration *)
   , Contours -> {500000, 1200000, 2200000}
   , ContourShading -> (RGBColor /@ colors2)
   , ContourStyle -> {{Thick, Dashed, Black}}
   
   (* Annotation *)
   , PlotLegends -> Placed[Automatic, Below]
   
   (* Region Configuration *)
   , GridLines -> {{.2, .4}, {10^6, 5*10^6}}
   , GridLinesStyle -> Directive[Black]
   ];

y = ListContourPlot[
   (* Data Specification *)
   data2
   
   (* General Configuration *)
   , Frame -> True
   , ImageSize -> Medium
   , PlotRangeClipping -> False
   , ScalingFunctions -> {None, "Log10"}
   
   (* Contour Configuration *)
   , Contours -> {500000, 1200000, 2200000}
   , ContourShading -> (RGBColor /@ colors2)
   , ContourStyle -> {{Thick, Dashed, Black}}
   
   (* Annotation *)
   , PlotLegends -> Placed[Automatic, Below]
   
   (* Region Configuration *)
   , GridLines -> {{.2, .4}, {10^6, 5*10^6}}
   , GridLinesStyle -> Directive[Black]
   ];

Grid @ {{
   Row @ {x, y}
   }}
$\endgroup$
2
$\begingroup$

Your subdivisions are far too coarse to fairly represent features on the vast numerical ranges involved, so features are missed / misplaced. Try with finer-pitched subdivisions:

data2 = Outer[
          {#1, #2, #1*#2} &, 
          Subdivide[.02, 1, 40], Subdivide[10^4, 2*10^7, 40]
        ] // Flatten[#, 1] &;

density plots from finer subdivisions

| improve this answer | |
$\endgroup$
  • $\begingroup$ In essence, this is the solution. I also have increased the number of elements produced by the Subdivide, and it fixed the problem. However, there must be something fundamental to the emerging issue. How do you select the appropriate numerical range? $\endgroup$ – e.doroskevic Jun 27 at 18:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.