0
$\begingroup$
data = {{0.00001, 0.00001, 0.00913538}, {0.00001, 0.10001, 
  14.0666}, {0.00001, 0.20001, 22.0695}, {0.00001, 0.30001, 
  27.8521}, {0.00001, 0.40001, 32.3443}, {0.00001, 0.50001, 
  35.9819}, {0.00001, 0.60001, 39.0109}, {0.00001, 0.70001, 
  41.5849}, {0.00001, 0.80001, 43.8067}, {0.00001, 0.90001, 
  45.7485}, {0.10001, 0.00001, 14.0666}, {0.10001, 0.10001, 
  26.1478}, {0.10001, 0.20001, 33.0256}, {0.10001, 0.30001, 
  37.9952}, {0.10001, 0.40001, 41.8559}, {0.10001, 0.50001, 
  44.9821}, {0.10001, 0.60001, 47.5852}, {0.10001, 0.70001, 
  49.7973}, {0.10001, 0.80001, 51.7068}, {0.10001, 0.90001, 
  53.3756}, {0.20001, 0.00001, 22.0695}, {0.20001, 0.10001, 
  33.0256}, {0.20001, 0.20001, 39.2628}, {0.20001, 0.30001, 
  43.7696}, {0.20001, 0.40001, 47.2707}, {0.20001, 0.50001, 
  50.1058}, {0.20001, 0.60001, 52.4665}, {0.20001, 0.70001, 
  54.4726}, {0.20001, 0.80001, 56.2042}, {0.20001, 0.90001, 
  57.7176}, {0.30001, 0.00001, 27.8521}, {0.30001, 0.10001, 
  37.9952}, {0.30001, 0.20001, 43.7696}, {0.30001, 0.30001, 
  47.942}, {0.30001, 0.40001, 51.1833}, {0.30001, 0.50001, 
  53.8081}, {0.30001, 0.60001, 55.9936}, {0.30001, 0.70001, 
  57.8508}, {0.30001, 0.80001, 59.454}, {0.30001, 0.90001, 
  60.8551}, {0.40001, 0.00001, 32.3443}, {0.40001, 0.10001, 
  41.8559}, {0.40001, 0.20001, 47.2707}, {0.40001, 0.30001, 
  51.1833}, {0.40001, 0.40001, 54.2229}, {0.40001, 0.50001, 
  56.6842}, {0.40001, 0.60001, 58.7336}, {0.40001, 0.70001, 
  60.4752}, {0.40001, 0.80001, 61.9785}, {0.40001, 0.90001, 
  63.2924}, {0.50001, 0.00001, 35.9819}, {0.50001, 0.10001, 
  44.9821}, {0.50001, 0.20001, 50.1058}, {0.50001, 0.30001, 
  53.8081}, {0.50001, 0.40001, 56.6842}, {0.50001, 0.50001, 
  59.0131}, {0.50001, 0.60001, 60.9524}, {0.50001, 0.70001, 
  62.6004}, {0.50001, 0.80001, 64.0228}, {0.50001, 0.90001, 
  65.2661}, {0.60001, 0.00001, 39.0109}, {0.60001, 0.10001, 
  47.5852}, {0.60001, 0.20001, 52.4665}, {0.60001, 0.30001, 
  55.9936}, {0.60001, 0.40001, 58.7336}, {0.60001, 0.50001, 
  60.9524}, {0.60001, 0.60001, 62.7999}, {0.60001, 0.70001, 
  64.3699}, {0.60001, 0.80001, 65.7251}, {0.60001, 0.90001, 
  66.9095}, {0.70001, 0.00001, 41.5849}, {0.70001, 0.10001, 
  49.7973}, {0.70001, 0.20001, 54.4726}, {0.70001, 0.30001, 
  57.8508}, {0.70001, 0.40001, 60.4752}, {0.70001, 0.50001, 
  62.6004}, {0.70001, 0.60001, 64.3699}, {0.70001, 0.70001, 
  65.8736}, {0.70001, 0.80001, 67.1716}, {0.70001, 0.90001, 
  68.306}, {0.80001, 0.00001, 43.8067}, {0.80001, 0.10001, 
  51.7068}, {0.80001, 0.20001, 56.2042}, {0.80001, 0.30001, 
  59.454}, {0.80001, 0.40001, 61.9785}, {0.80001, 0.50001, 
  64.0228}, {0.80001, 0.60001, 65.7251}, {0.80001, 0.70001, 
  67.1716}, {0.80001, 0.80001, 68.4202}, {0.80001, 0.90001, 
  69.5115}, {0.90001, 0.00001, 45.7485}, {0.90001, 0.10001, 
  53.3756}, {0.90001, 0.20001, 57.7176}, {0.90001, 0.30001, 
  60.8551}, {0.90001, 0.40001, 63.2924}, {0.90001, 0.50001, 
  65.2661}, {0.90001, 0.60001, 66.9095}, {0.90001, 0.70001, 
  68.306}, {0.90001, 0.80001, 69.5115}, {0.90001, 0.90001, 70.565}}

I plot the data:

ListDensityPlot[data, PlotLegends -> {Placed[Automatic, Right]}, 
 ColorFunction -> ColorData["Rainbow"]]

enter image description here

Now I have other data:

data2={{0.00001, 0.00001, 0.00913538}, {0.00001, 0.10001, 
  14.0666}, {0.00001, 0.20001, 22.0695}, {0.00001, 0.30001, 
  27.8521}, {0.00001, 0.40001, 32.3443}, {0.10001, 0.00001, 
  14.0666}, {0.10001, 0.10001, 26.1478}, {0.10001, 0.20001, 
  33.0256}, {0.10001, 0.30001, 37.9952}, {0.10001, 0.40001, 
  41.8559}, {0.20001, 0.00001, 22.0695}, {0.20001, 0.10001, 
  33.0256}, {0.20001, 0.20001, 39.2628}, {0.20001, 0.30001, 
  43.7696}, {0.20001, 0.40001, 47.2707}, {0.30001, 0.00001, 
  27.8521}, {0.30001, 0.10001, 37.9952}, {0.30001, 0.20001, 
  43.7696}, {0.30001, 0.30001, 47.942}, {0.30001, 0.40001, 
  51.1833}, {0.40001, 0.00001, 32.3443}, {0.40001, 0.10001, 
  41.8559}, {0.40001, 0.20001, 47.2707}, {0.40001, 0.30001, 
  51.1833}, {0.40001, 0.40001, 54.2229}}

Again, I can plot it: enter image description here

Now my question is: How can I make sure that the color assigned to each value in the first plot is assigned to the same values in the second plot ?

$\endgroup$
3
$\begingroup$

Use MinMax[] to get the extent of the $z$-values in data:

dzr = MinMax[data[[All, 3]]];

From there, feed this range into ColorData[], and set ColorFunctionScaling -> False:

Column[{ListDensityPlot[data, ColorFunction -> ColorData[{"Rainbow", dzr}], 
                        ColorFunctionScaling -> False, ImageSize -> Small, 
                        PlotLegends -> Placed[Automatic, Right]], 
        ListDensityPlot[data2, ColorFunction -> ColorData[{"Rainbow", dzr}],
                        ColorFunctionScaling -> False, ImageSize -> Small, 
                        PlotLegends -> Placed[Automatic, Right]]}]

two plots

$\endgroup$
  • $\begingroup$ Thanks a lot ! This is perfect ! :) $\endgroup$ – james Oct 3 '18 at 20:01

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.