Reverse the colorbar axis
古いコメントを表示
I have a contourf plot, which I plotted across the range 2 to -2. I have edited the colormap to get it to move between green and brown.
I don't want to change the colormap, or the values that are associated with each color. All I want to do is essentially flip the colorbar, so that -2 is at the top, and 2 is at the bottom.
All the solutions I have found so far only flip the colors, which is not what I want to do.
I'm basically looking for an equivalent function to: set(gcf,'YDir','reverse') but for the colorbar.
I'd appreciate any help I can get. Cheers, Claire.
1 件のコメント
Cody Webb
2015 年 10 月 25 日
How did you flip just the colors and not the axis?
採用された回答
その他の回答 (1 件)
Ryan Caveney
2025 年 2 月 14 日
Another solution is
cm = colormap;
colormap(flipud(cm));
カテゴリ
ヘルプ センター および File Exchange で Color and Styling についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!