Important usage note: As mentioned above, reportColorRange
monitors the plotting function as it creates the plot. Therefore, you have to provide the actual plotting function as the argument: reportColorRange[DensityPlot[...]]
and not something like this: p = DensityPlot[...]; reportColorRange[p]
. The latter won't work because the variable p
then contains the already finished plot, and this can't be used to monitor the true minima and maxima of the function range that was explored during the creation of p
.
Color bar legend
The last example with a banded color legend was also the topic of another question where I added a different variant of colorLegend
. That definition can be added to the one in this answer without conflict. The linked version simply has a third argument n
corresponding to the number of discrete tick marks in the legend. This may sometimes be more convenient that the "ColorSwathes"
option.