# Common legend for two density plots

I have two different density maps, one of them is made by DensityPlot and the another one is made by ListDensityPlot. I would like to compare the uniformity of the data that is plotted. For that, I want them to be in the same color scale, with a common legend. I have tried to use the Legended function, but it only lets me build a legend, which doesn't change the color distribution of the plots.

How can I do this?

Edit: Here is my code. Bxarray is an array of elements of the form {x,y,f(x,y)} and Bx is an analytic expression defined before.

BxSaddleMapPlot =
ListDensityPlot[Bxarray /. (Bxarray[[3]] -> Abs[Bxarray[[3]]]),
ColorFunction -> "Rainbow" , PlotLegends -> Automatic]


 h = DensityPlot[Abs[Bx] /. z -> L/2, {x, -0.6, 0.6}, {y, -0.6, 0.6},
ColorFunction -> "Rainbow", PlotLegends -> Automatic]


I want to show both plots together following the same color scale, with a common legend. For example, if the maximum value 0.025 is going to be bright red, the plot h will be green~yellow at the center.

I hope it clarifies the question. Thanks.

• Please post your code. – David G. Stork Jun 20 '17 at 0:21
• You will greatly increase your chances of getting help here if you were to put more effort into your question. If you have code that is not giving the results you want, show the code and describe exactly what you expected to get but didn't. No one wants guess at a solution for a problem so poorly described as this one is. – m_goldberg Jun 20 '17 at 0:32
• For having the same color scale, look at ColorFunction and ColorFunctionScaling. For putting them side by side have a look at this or this – yohbs Jun 20 '17 at 4:15