Group Abstract Group Abstract

Message Boards Message Boards

1
|
6.2K Views
|
6 Replies
|
3 Total Likes
View groups...
Share
Share this post:

[?] Reverse BarLegend colors?

I've made this BarLegend:

BarLegend[{"Rainbow", {15, 45}}, LegendLabel -> "P (m)", 
 LegendMarkerSize -> 200, LegendLayout -> "Row"]

Is there any way to reverse its colors?

Thank you in advance!

6 Replies

It works!

Clever solution!

Thank you very much Rohit!

Posted 7 years ago
POSTED BY: Rohit Namjoshi
Posted 7 years ago

Not sure what you are trying to achieve. If you want to use a different gradient you can use any of the ones supported by ColorData.

ColorData["Gradients"]
(* {"AlpineColors", "Aquamarine", "ArmyColors", "AtlanticColors", 
"AuroraColors", "AvocadoColors", "BeachColors", "BlueGreenYellow", 
"BrassTones", "BrightBands", "BrownCyanTones", "CandyColors", 
"CherryTones", "CMYKColors", "CoffeeTones", "DarkBands", 
"DarkRainbow", "DarkTerrain", "DeepSeaColors", "FallColors", 
"FruitPunchColors", "FuchsiaTones", "GrayTones", "GrayYellowTones", 
"GreenBrownTerrain", "GreenPinkTones", "IslandColors", "LakeColors", 
"LightTemperatureMap", "LightTerrain", "MintColors", "NeonColors", 
"Pastel", "PearlColors", "PigeonTones", "PlumColors", "Rainbow", 
"RedBlueTones", "RedGreenSplit", "RoseColors", "RustTones", 
"SandyTerrain", "SiennaTones", "SolarColors", "SouthwestColors", 
"StarryNightColors", "SunsetColors", "TemperatureMap", 
"ThermometerColors", "ValentineTones", "WatermelonColors"} *)

e.g.

BarLegend[{{"TemperatureMap", "Reverse"}, {15, 45}}, 
 LegendLabel -> "P (m)", LegendMarkerSize -> 200, 
 LegendLayout -> "Row"]

enter image description here

POSTED BY: Rohit Namjoshi

Thank you very much! It's exactly what I wanted!

However, it doesn't work with ColorData:

ColorData[{{"Rainbow", "Reverse"}, {15, 45}}]
(*ColorData::notent: {{Rainbow,Reverse},{15,45}} is not a known entity, class, or tag for ColorData. Use ColorData[] for a list of entities.*)
Posted 7 years ago
BarLegend[{{"Rainbow", "Reverse"}, {15, 45}}, LegendLabel -> "P (m)", 
 LegendMarkerSize -> 200, LegendLayout -> "Row"]

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard