Change color of binscatter plot

8 ビュー (過去 30 日間)
David Ramjit
David Ramjit 2018 年 4 月 22 日
回答済み: Adam Danz 2025 年 6 月 20 日
I would like to change the color of the binscatter I have done but I am unsure what is the syntax. I saw I can use colormap(gca,'parula') but I would like to change it to one specific self defined color.

回答 (1 件)

Adam Danz
Adam Danz 2025 年 6 月 20 日
binscatter uses a colormap to show densities. Setting binscatter to a single color would defeate the purpose of the function because density would no longer be visually represented. I suppose a use case of applying one color would be to show the range of 2D coordinates contained in the data. Note that binscatter does not currenltly have alpha mapping which could be used with a single color to indicate density (similar to geoscatter).
Nevertheless, set the colormap to a single color if you only want to use one color.
x = randn(1,100)*20;
y = randn(1,100)*15;
% Default appearance
binscatter(x,y)
% Apply single color
binscatter(x,y)
colormap([.07 .44 .75])

カテゴリ

Help Center および File ExchangeDescriptive Statistics and Visualization についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by