Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

The trimPoint is adapted from herehere, and is intended to make the labels in the legend look nicer.

The trimPoint is adapted from here, and is intended to make the labels in the legend look nicer.

The trimPoint is adapted from here, and is intended to make the labels in the legend look nicer.

replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

The functions at and display are adapted from another answeranother answer and serve only to make it easier to position the plot and its legend in a single Graphics.

The last example with a banded color legend was also the topic of another question where I added a different variant of colorLegendanother 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.

The functions at and display are adapted from another answer and serve only to make it easier to position the plot and its legend in a single Graphics.

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.

The functions at and display are adapted from another answer and serve only to make it easier to position the plot and its legend in a single Graphics.

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.

Added usage note for reportColorRange
Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

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 the above to the definitiona 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.

Color bar legend

The last example with a banded color legend was also the topic of another question where I added the above to the definition 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.

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.

Added link back to related question.
Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510
Loading
Added new options to colorLegend, added more comments in code, added new examples
Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510
Loading
Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510
Loading