1
$\begingroup$

I have the following data. I want to draw a List Contour with Log-Log on both axes using this data and then have to fill only the upper part and the elliptical part of the obtained contour log-log plot. I am using Mathematica 12.1. Any suggestion will be highly appreciated. Thanks!

Edited: The additional constraints are the following:

  1. The DataRange should be {{0,30},{5,30}}.
  2. There should be only one contour corresponding to the 300 boundary.
  3. The upper part should only be colored as @tad have shown, while the lower part should have a different color.
  4. This results into two connected contour regions, first between ~0-20 on x-axis and ~8-9 on y-axis. The second one is the larger contour which covers the whole area between 0-30 on axis and ~5-27 on y-axis. The 2nd contour looks exactly as shown by @tad except for a single contour and the correct range of both axes. This is also somehow shown by @kglr except he has colored the lower parts only. Thanks!
{{321.983, 321.992, 322.017, 322.06, 322.119, 322.195, 322.287,
  322.395, 322.518, 322.656, 322.807, 322.971, 323.147, 323.333,
  323.528, 323.731, 323.941, 324.156, 324.376, 324.598, 324.823,
  325.048, 325.272, 325.496, 325.717, 325.936, 326.151, 326.363,
  326.57, 326.772}, 
 {312.952, 312.968, 313.014, 313.091, 313.198,
  313.335, 313.503, 313.7, 313.925, 314.178, 314.457, 314.761,
  315.087, 315.434, 315.801, 316.183, 316.58, 316.988, 317.405,
  317.83, 318.259, 318.691, 319.123, 319.555, 319.983, 320.407,
  320.826, 321.237, 321.641, 322.036}, 
 {300.985, 301.006, 301.07,
  301.177, 301.327, 301.521, 301.759, 302.041, 302.367, 302.736,
  303.147, 303.599, 304.09, 304.617, 305.177, 305.767, 306.384,
  307.023, 307.682, 308.356, 309.042, 309.737, 310.436, 311.137,
  311.837, 312.532, 313.222, 313.903, 314.573, 315.231}, 
 {289.652,
  289.669, 289.722, 289.812, 289.941, 290.112, 290.329, 290.594,
  290.91, 291.28, 291.706, 292.187, 292.725, 293.318, 293.964, 294.66,
  295.403, 296.189, 297.013, 297.87, 298.755, 299.663, 300.589,
  301.528, 302.476, 303.427, 304.379, 305.326, 306.267,
  307.197}, 
 {288.345, 288.33, 288.284, 288.213, 288.124, 288.026,
  287.932, 287.853, 287.801, 287.789, 287.827, 287.924, 288.089,
  288.327, 288.641, 289.033, 289.503, 290.05, 290.67, 291.359,
  292.112, 292.923, 293.784, 294.691, 295.636, 296.612, 297.613,
  298.632, 299.665, 300.705}, 
 {316.571, 316.453, 316.106, 315.54,
  314.775, 313.836, 312.755, 311.564, 310.298, 308.992, 307.682,
  306.397, 305.166, 304.014, 302.96, 302.021, 301.207, 300.528,
  299.986, 299.583, 299.316, 299.182, 299.174, 299.285, 299.505,
  299.827, 300.24, 300.735, 301.301, 301.93}, 
 {410.157, 409.801,
  408.743, 407.01, 404.647, 401.712, 398.276, 394.416, 390.217,
  385.764, 381.141, 376.427, 371.697, 367.018, 362.447, 358.035,
  353.82, 349.836, 346.105, 342.643, 339.459, 336.556, 333.933,
  331.584, 329.498, 327.666, 326.072, 324.703, 323.542,
  322.573}, 
 {629.903, 629.056, 626.537, 622.401, 616.741, 609.681,
  601.367, 591.966, 581.656, 570.621, 559.044, 547.099, 534.955,
  522.762, 510.656, 498.757, 487.164, 475.961, 465.212, 454.968,
  445.262, 436.118, 427.545, 419.546, 412.113, 405.233, 398.888,
  393.055, 387.708, 382.822}, 
 {1073.22, 1071.45, 1066.17, 1057.5,
  1045.62, 1030.76, 1013.21, 993.305, 971.39, 947.83, 922.989,
  897.221, 870.864, 844.228, 817.595, 791.215, 765.303, 740.039,
  715.571, 692.015, 669.459, 647.964, 627.568, 608.289, 590.129,
  573.076, 557.106, 542.186, 528.277, 515.333},
 {1889.4, 1885.99,
  1875.83, 1859.13, 1836.22, 1807.53, 1773.61, 1735.05, 1692.5,
  1646.65, 1598.17, 1547.73, 1495.97, 1443.47, 1390.78, 1338.37,
  1286.67, 1236.03, 1186.75, 1139.07, 1093.17, 1049.18, 1007.19,
  967.267, 929.423, 893.651, 859.923, 828.191, 798.393,
  770.457}, 
 {3299.18, 3293.02, 3274.64, 3244.41, 3202.91, 3150.91,
  3089.34, 3019.29, 2941.88, 2858.34, 2769.85, 2677.62, 2582.77,
  2486.37, 2389.39, 2292.7, 2197.06, 2103.14, 2011.47, 1922.51,
  1836.61, 1754.02, 1674.94, 1599.49, 1527.71, 1459.61, 1395.17,
  1334.31, 1276.94, 1222.94},
 {5619.43, 5608.8, 5577.12, 5524.98,
  5453.37, 5363.6, 5257.26, 5136.15, 5002.21, 4857.5, 4704.06,
  4543.93, 4379.04, 4211.21, 4042.11, 3873.26, 3705.98, 3541.39,
  3380.48, 3224.02, 3072.64, 2926.81, 2786.88, 2653.08, 2525.52,
  2404.24, 2289.2, 2180.31, 2077.42, 1980.35},
 {9293.58, 9275.96,
  9223.44, 9137.01, 9018.27, 8869.35, 8692.86, 8491.75, 8269.21,
  8028.59, 7773.26, 7506.57, 7231.7, 6951.66, 6669.23, 6386.89,
  6106.86, 5831.02, 5561., 5298.12, 5043.44, 4797.77, 4561.71,
  4335.67, 4119.86, 3914.37, 3719.17, 3534.12, 3359.,
  3193.52},
 {14928.9, 14900.6, 14816.4, 14677.8, 14487.4, 14248.5,
  13965.2, 13642.3, 13284.9, 12898.2, 12487.6, 12058.5, 11616.,
  11164.9, 10709.5, 10254., 9801.78, 9356., 8919.23, 8493.64, 8080.94,
   7682.47, 7299.21, 6931.85, 6580.77, 6246.14, 5927.94, 5625.96,
  5339.88, 5069.28},
 {23341.3, 23297.3, 23166.1, 22950.1, 22653.2,
  22280.7, 21839., 21335.3, 20777.6, 20173.9, 19532.8, 18862.5,
  18170.8, 17465.2, 16752.8, 16039.6, 15331.2, 14632.5, 13947.5,
  13279.5, 12631.4, 12005.2, 11402.5, 10824.3, 10271.4, 9744.01,
  9242.13, 8765.48, 8313.59, 7885.81},
 {35609.1, 35542.2, 35342.7,
  35014.3, 34562.9, 33996.5, 33324.7, 32558.5, 31709.8, 30791.,
  29814.9, 28794., 27740.1, 26664.8, 25578.5, 24490.6, 23409.6,
  22342.9, 21296.5, 20275.8, 19284.8, 18326.9, 17404.4, 16519.,
  15671.9, 14863.4, 14093.6, 13362.1, 12668.2, 12011.},
 {53135.7,
  53036.2, 52739.6, 52251.2, 51579.8, 50737.3, 49737.8, 48597.7,
  47334.6, 45967., 44513.7, 42993.2, 41423.3, 39820.9, 38201.6,
  36579.6, 34967.2, 33375.5, 31813.7, 30289.6, 28809.4, 27377.9,
  25998.9, 24674.9, 23407.5, 22197.5, 21044.8, 19949.1, 18909.3,
  17923.9},
 {77724.2, 77579.2, 77146.6, 76434.3, 75455.2, 74226.3,
  72768.3, 71104.9, 69261.9, 67266., 65144.6, 62924.7, 60632.3,
  58291.9, 55926.2, 53555.9, 51199.2, 48872., 46588., 44358.4,
  42192.3, 40097.1, 38078., 36138.8, 34281.9, 32508.5, 30818.7,
  29211.8, 27686.3, 26240.5},
 {111663., 111455., 110835., 109815.,
  108412., 106650., 104561., 102177., 99534.7, 96673.2, 93631.3,
  90447.7, 87159.5, 83801.9, 80407.5, 77005.7, 73622.7, 70281.4,
  67001.4, 63798.8, 60686.8, 57675.8, 54773.5, 51985.4, 49315.,
  46764.1, 44332.8, 42020.1, 39824.3, 37742.3},
 {157825., 157532.,
  156657., 155218., 153239., 150756., 147808., 144445., 140718.,
  136681., 132389., 127896., 123255., 118516., 113723., 108920.,
  104143., 99423.1, 94789.3, 90264.1, 85866.2, 81610.1, 77507.,
  73564.6, 69787.9, 66179.4, 62739.4, 59466.7, 56358.6,
  53411.3},
 {219780., 219373., 218158., 216157., 213407., 209955.,
  205858., 201182., 196001., 190387., 184419., 178171., 171717.,
  165124., 158457., 151774., 145127., 138559., 132109., 125810.,
  119686., 113760., 108046., 102554., 97292.9, 92265., 87471.2,
  82909.8, 78577.1, 74467.8},
 {301927., 301369., 299702., 296959.,
  293187., 288451., 282831., 276418., 269309., 261608., 253420.,
  244846., 235989., 226942., 217791., 208618., 199491., 190474.,
  181618., 172967., 164557., 156417., 148566., 141022., 133792.,
  126882., 120293., 114022., 108066., 102415.},
 {409639., 408882.,
  406624., 402907., 397796., 391379., 383764., 375074., 365441.,
  355005., 343907., 332287., 320281., 308017., 295612., 283175.,
  270800., 258572., 246562., 234829., 223422., 212379., 201728.,
  191491., 181680., 172303., 163360., 154849., 146762.,
  139091.},
 {549425., 548411., 545386., 540406., 533559., 524963.,
  514761., 503117., 490210., 476226., 461355., 445784., 429694.,
  413257., 396630., 379959., 363371., 346978., 330875., 315144.,
  299847., 285038., 270754., 257024., 243864., 231284., 219286.,
  207866., 197016., 186721.},
 {729122., 727777., 723768., 717166.,
  708088., 696691., 683165., 667728., 650614., 632072., 612353.,
  591704., 570367., 548567., 526516., 504404., 482401., 460655.,
  439294., 418423., 398128., 378478., 359524., 341303., 323838.,
  307142., 291216., 276057., 261653., 247985.},
 {958096., 956331.,
  951067., 942399., 930481., 915517., 897758., 877488., 855017.,
  830670., 804775., 777660., 749638., 721009., 692048., 663005.,
  634104., 605540., 577479., 550060., 523397., 497580., 472676.,
  448733., 425782., 403840., 382911., 362987., 344053., 326087.}}
$\endgroup$
2
  • 2
    $\begingroup$ Please be more specific on what is to be colored and how. For example, between contours 200000 and 450000, or everything above contour 400000. Is the color to be monotone or a gradient? $\endgroup$
    – Bob Hanlon
    Dec 22, 2020 at 21:24
  • $\begingroup$ @BobHanlon, Hi Bob, Well, If you simply ListContourPlot the above data with the range of {0,30} on x-axis and {5,30} on y-axis and restrict to only one contour corresponding to 300, you will see two connected contours. I have explained above in the edited part. I want the upper white area to be colored and the horn region colored, while the rest as uncooled or filled with a different color. Moreover, the axes should be on the log scale. $\endgroup$
    – SciJewel
    Dec 23, 2020 at 10:30

1 Answer 1

1
$\begingroup$

You can use the ScalingFunctions option to specify log scale for the axes.

A ColorFunction option can color contours based on any function you want of their values.

Here's an example, after setting the variable 'data' to the values in the question. You can change the ColorFunction to specify which contours to color. This example colors contours for values above 10^5.

ListContourPlot[data, ScalingFunctions -> {"Log", "Log", None}, 
  PlotRange -> All, 
  ColorFunctionScaling -> False, 
  ColorFunction -> Function[f, 
    If[f > 10^5, ColorData["SolarColors"][Rescale[Log@f, Log@{10^5, Max[data]}]], None]
  ]
]

contour plot with log axes and selective coloring

$\endgroup$
4
  • $\begingroup$ :Thanks for the smart attempt! However, I only want one contour correspond to 300. Please extend the data range to {0,30} on x-axis and {5,30} on y-axis with logarithmic scale. Please read my edit post above. Thanks! $\endgroup$
    – SciJewel
    Dec 23, 2020 at 10:41
  • $\begingroup$ I'm confused by how a data range of {0,30} can use a log scale: x=0 on a log scale corresponds to minus infinity. To specify a single contour value at 300, you can use the option Contours -> {300}. This will automatically give different colors to the two regions -- no need for the ColorFunction (unless you want different colors than the default). If by "data range" you mean to extend the range of the plot rather than the data, you can use the PlotRange option. $\endgroup$
    – tad
    Dec 27, 2020 at 0:08
  • $\begingroup$ thanks for the message. Sorry, by zero, I mean the approximated value. Actually, the above data was obtained from the given code with range for the x-axis as {5,30} in unit steps of 1 and on y-axis with range-> {0.00001, 30} in unit step of 1. In the above cases, its seems that some of the points are not plotted. By specifying the ranges on both axis, it might show the full ranges. If Conours->{30}. Could you please explain a bit this part of the code: ColorFunction -> Function[f, If[f > 10^5, ColorData["SolarColors"][Rescale[Log@f, Log@{10^5, Max[data]}]], None] ]. Thanks! $\endgroup$
    – SciJewel
    Dec 28, 2020 at 15:21
  • $\begingroup$ That ColorFunction specifies a color to use if the value is larger than 10^5, otherwise None indicates no color. $\endgroup$
    – tad
    Jan 2, 2021 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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