I am trying to show the legend with a ColorData
for a discrete Fourier transform coefficient table.
Here's a sample data table:
f={{0,26.6185,6.54197,1.32902,0.862353},
{12.3854,4.09068,3.39286,0.208909,0.340049},
{1.86011,1.79171,0.294318,0.930939,0.13115},
{0.402539,0.448201,0.176836,0.240318,0.162534},
{0.107348,0.0917102,0.13862,0.278679,0.0561954}}
The MatrixPlot
of the above data is as such:
MatrixPlot[f]
The MatrixPlot
with ColorData
(as in the help manual at PlotLegends/ref/ShowLegend) is as follows:
Needs["PlotLegends`"];
ShowLegend[
MatrixPlot[f,
BaseStyle -> {FontWeight -> "Plain",
FontSize -> 25}], {ColorData["TemperatureMap"][1 - #1] &, 20,
"-1", "1", LegendPosition -> {1.1, -.4}}
]
Obviously, changing the "-1", "1"
would change the limits on the legend. How should I have the maximum and the minimum of f
show up instead of the non-sensical (for this case) 1
and -1
?
I tried changing the ShowLegend
to
ShowLegend[
MatrixPlot[f, BaseStyle->{FontWeight->"Plain",FontSize->25}],
{ColorData["TemperatureMap"][1-#1]&,20,Max[f],Min[f],
LegendPosition->{1.1,-.4}}
]
but to no avail.
I have looked around and there has to be an easier way out than this dissertation!
ToString@Min[f], ToString@Max[f]
works for me. $\endgroup$