Sometimes, it is useful to plot only a single legend for several figures, for example, those were produced by DensityPlot. The following is an example from the document.
Generate a numerical solution to plot:
usol = NDSolveValue[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, u[t, 0] == Sin[t], u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}] The first plot for $t\in[0,2]$ and the 2nd one for $t\in[2,10]$
dplt1 = DensityPlot[usol[t, x], {t, 0, 2}, {x, 0, 5}, PlotLegends -> Automatic, PlotRange -> All, ImageSize -> 200] dplt2 = DensityPlot[usol[t, x], {t, 2, 10}, {x, 0, 5}, PlotLegends -> Automatic, PlotRange -> All, ImageSize -> 200] They give two plots with different legend ranges.
My questions are two-fold:
How to generate a single legend with the same max and min values for both figures. The max and min could be observed by firstly using
PlotLegends -> Automaticand then plot a uniform legend with the global max/min values;What is an appropriate method to export such a legend in .eps, to be edited further in graphic software, e.g. Illustrator? I have tried to export the automatically produced bar-legend with
Export[".eps"], however, I found its ticks are not short lines but like rectangles, which are hard to edit, e.g. thickness or color.





{t, 0, 10}, {x, 0, 5}to make a single densityplot? $\endgroup$