0
$\begingroup$

I have two ArrayPlot and I would like to show using one legend. The flowing is works. My question is can we use ColorFunction -> (Blend[{RGBColor[0, 0, 1], RGBColor[0, 1, 0], RGBColor[1, 1, 0], RGBColor[1, 0, 0]}, #] &) this instead of "TemperatureMap". I want to replace white color with green one. Any suggestion? Thanks.

dataRawIPTG = {{2.18756, 2.17447, 2.17031, 2.16801, 2.31719, 
2.36214}, {2.14151, 2.13749, 2.13819, 2.14531, 2.35749, 
2.40783}, {2.18333, 2.16507, 2.17598, 2.21962, 3.52217, 
3.60957}, {2.21752, 2.14844, 2.15905, 2.76315, 3.70188, 
3.83357}, {2.25902, 2.17451, 2.18496, 2.83573, 3.6727, 
3.82887}, {2.23612, 2.14, 2.17541, 2.76535, 3.61427, 3.80555}};

dataModelIPTG = {{2.10966, 2.10985, 2.11809, 2.22362, 2.30687, 
2.31404}, {2.1349, 2.13515, 2.14581, 2.29441, 2.42998, 
2.44253}, {2.22229, 2.22278, 2.24442, 2.67876, 3.57224, 
3.71233}, {2.22434, 2.22483, 2.24678, 2.69184, 3.6357, 
3.78727}, {2.22436, 2.22485, 2.2468, 2.69197, 3.63634, 
3.78802}, {2.22436, 2.22485, 2.2468, 2.69197, 3.63635, 3.78804}};

minMaxIPTG = MinMax[{dataRawIPTG, dataModelIPTG}];

Framed@Legended[Grid[{{ArrayPlot[dataRawIPTG, ColorFunctionScaling -> False, 
  ColorFunction -> ColorData[{"TemperatureMap", minMaxIPTG}], 
  Frame -> True, FrameTicks -> {Automatic, Range@6}, 
  ImageSize -> 170, DataReversed -> True], 
 ArrayPlot[dataModelIPTG, ColorFunctionScaling -> False, 
  ColorFunction -> ColorData[{"TemperatureMap", minMaxIPTG}], 
  Frame -> True, FrameTicks -> {Automatic, Range@6}, 
  ImageSize -> 170, DataReversed -> True]}}],  BarLegend[{"TemperatureMap", minMaxIPTG}, LegendMarkerSize -> 170,   LegendLabel -> 
Placed["Fluorescence (MEPE)", Right, Rotate[#, 90 Degree] &]]]
$\endgroup$
  • $\begingroup$ You'll need Rescale[]: okkesCF = Blend[{RGBColor[0, 0, 1], RGBColor[0, 1, 0], RGBColor[1, 1, 0], RGBColor[1, 0, 0]}, Rescale[#, minMaxIPTG]] &;. $\endgroup$ – J. M. will be back soon Apr 8 '17 at 16:11
  • $\begingroup$ Thanks, that works perfectly for ArrayPlot but how can I apply it to Legend, too. $\endgroup$ – OkkesDulgerci Apr 8 '17 at 16:32
  • $\begingroup$ Try BarLegend[{okkesCF, minMaxIPTG}, (* stuff *)] $\endgroup$ – J. M. will be back soon Apr 8 '17 at 16:34
  • $\begingroup$ @J.M. It worked. Thank you. I guess I was using BarLegend[{"okkesCF", minMaxIPTG}, (* stuff* )] and it did not work that way. $\endgroup$ – OkkesDulgerci Apr 8 '17 at 17:54
  • $\begingroup$ @J.M. How can I do the same thing for this . I mean I want to use blended color not "TemperatureMap" $\endgroup$ – OkkesDulgerci Apr 9 '17 at 1:01

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.