Use colormap to color axis?

조회 수: 4(최근 30일)
Roger Breton
Roger Breton 2022년 1월 16일
댓글: Walter Roberson 2022년 1월 17일
From reading the documentation, it seems axes colors can only be 'uniform'.
Would there be a way to apply a colormap to an axes color property?
  댓글 수: 2
Image Analyst
Image Analyst 2022년 1월 16일
Why throw in the towel? Didn't my answer below do what you want?

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2022년 1월 16일
I think you'd have to use line() to draw colored line segments along the x axis:
plot(1 : 10, 'b.-', 'LineWidth', 2, 'MarkerSize', 30);
xl = xlim()
yl = ylim()
xs = linspace(xl(1), xl(2), 200);
hold on;
colorList = turbo(length(xs));
xAxisWidth = 4;
for k = 1 : length(xs)
thisColor = colorList(k, :);
line([xs(k), xl(end)], [0, 0], 'Color', thisColor, 'LineWidth', xAxisWidth)
hold off;
  댓글 수: 7

댓글을 달려면 로그인하십시오.




Community Treasure Hunt

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

Start Hunting!

Translated by