I have generated a graphic using ListDensityPlot in Mathematica, I want to make following three edits to it, but not finding a way. Would be thankful for any advice.

  1. How to rotate the graphic. My graphic is triangular in shape, I want to orient it in a fixed direction. How to make a particular corner to be at top, which can be identified with its Cartesian coordinates (say, by (0, 0)) ?

  2. I want a fixed range to be shown by the false color scale to represent different colors on graphic. I am not able to do so as irrespective of the range I choose for PlotLegends, the scale shows only the range which is available on graphic. For example if the graphic has area having the plotted variable varying between 0 to 5, no matter what range i choose for PlotLegends->, false color scale only shows the colors representing the values 0-5 only. How to change it ?

  3. Instead of leveling the three axes, I want to level the three edges with their coordinates (with no frame). How to achieve it ?

Here is the example for the truncated triangle.

ListContourPlot[XX1,PlotLegends->{0, 1, 2, 3, 4, 5, 6, 7, 8},ColorFunction->"AvocadoColors"]

Will appreciate any help.

  • $\begingroup$ Can you provide the code you are using and some visuals explaining the desired result? $\endgroup$ Commented Oct 11, 2019 at 1:49
  • $\begingroup$ I have added a small example in the original post. $\endgroup$
    – user49535
    Commented Oct 11, 2019 at 4:16
  • $\begingroup$ Still not clear to me what you are trying to achieve. For 1. and 3. maybe this? ListContourPlot[XX1, PlotLegends -> {0, 1, 2, 3, 4, 5, 6, 7, 8}, ColorFunction -> "AvocadoColors", ScalingFunctions -> {Identity, "Reverse"}, PlotRangePadding -> None] $\endgroup$ Commented Oct 11, 2019 at 4:29
  • $\begingroup$ Thanks. For point 2, the false color scale is having colors for 2-8. What I want is 0-8, even if there is no points in the list corresponding to 0. $\endgroup$
    – user49535
    Commented Oct 11, 2019 at 4:45

1 Answer 1



BarLegend inside plot area.

 PlotLegends -> 
  Placed[BarLegend[{"AvocadoColors", {0, 8}}, LegendLayout -> "Row", LegendMarkerSize -> 200], 
    {.28, .06}], 
 ColorFunction -> "AvocadoColors", 
 ScalingFunctions -> {Identity, "Reverse"}, PlotRangePadding -> None]

enter image description here

For 1.

ScalingFunctions -> {Identity, "Reverse"}

For 2.

PlotLegends -> BarLegend[{"AvocadoColors", {0, 8}}]

For 3.

PlotRangePadding -> None

 PlotLegends -> BarLegend[{"AvocadoColors", {0, 8}}], 
 ColorFunction -> "AvocadoColors", 
 ScalingFunctions -> {Identity, "Reverse"}, PlotRangePadding -> None]

enter image description here

  • $\begingroup$ Thanks a lot ! Though I have one more question. How to move the Legend Bar on the free area on the left (within the graphic area) with a decrease in size (so that it can fit into the free triangular space). I could find the method to put it at top/bottom/left/right, but not within the graphic. $\endgroup$
    – user49535
    Commented Oct 12, 2019 at 11:07
  • $\begingroup$ @user49535 If this answer is acceptable, please consider upvoting and accepting it. If it is not, please explain why. $\endgroup$ Commented Oct 16, 2019 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.