MATLAB Answers

specifing a colorbar parent/figure

9 views (last 30 days)
William
William on 2 Apr 2015
Commented: William on 16 Apr 2015
How are you supposed to set the figure to which a colorbar is associated? At the moment, when I introduce a colorbar it automatically assigns itself to another figure without any mention of that figure.
i.e. associate colorbar with "plot" figure
imshow(data,'Parent',plot);
colormap(plot, jet)
colorbar
caxis(plot,[0 max_I])
Many thanks,

  1 Comment

William
William on 16 Apr 2015
still stuck on this, please advise

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 16 Apr 2015
After R2014b:
imshow(data, 'Parent', hPlot);
colormap(hPlot, jet(256));
colorbar(hPlot);
R2014a and earlier:
axes(hPlot);
imshow(data);
colormap(jet(256));
colorbar;
Do NOT use plot as the handle to your axes. plot() is the name of a built in function and it is never a good idea to use the names of built-in functions for your variables.

  1 Comment

William
William on 16 Apr 2015
thanks for the heads up

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by