How can I hide the black line on the right side of colorbar
Show older comments

9 Comments
Umar
on 27 Jul 2024
Edited: Walter Roberson
on 28 Jul 2024
Hi Hongyun,
By setting the 'Box' property of the colorbar to 'off', you can effectively hide the black line on the right side of the colorbar in Matlab. Here is example code snippet.
% Remove the black line on the colorbar
c = colorbar;
c.Box = 'off';
I hope this will help resolve your problem. Please let me know if you have any further questions.
Hongyun
on 27 Jul 2024
Voss
on 27 Jul 2024
How did you create this colorbar? It doesn't look like a colorbar created with the built-in MATLAB colorbar() function.
Hongyun
on 27 Jul 2024
Edited: Walter Roberson
on 28 Jul 2024
Umar
on 27 Jul 2024
Hi Hongyun,
Could you share the code snippet that you are having issue with,it will help clarify the problem.
David Goodmanson
on 28 Jul 2024
Hello Hongyun,
figure(1)
mesh(peaks(40))
cb = colorbar
cb.Box = 'off'
With cbarrow not involved, you still see a vertical line on the right hand side of the colorbar. That line appears to be associated with the scale and the tick marks, and it may not be so easy to remove.
Hongyun
on 29 Jul 2024
Image Analyst
on 29 Jul 2024
@Umar, if you post your Answers down below in the official Answers section, you can get credit (reputation points) for it if someone accepts it or votes for it. Up here in the comments section, you can't, because up here is where people generally just ask for clarification of the question rather than give an answer. 🙂
Umar
on 29 Jul 2024
@Image Analyst,
Your comments have been noted. By the way how do you get nominated for most anticipated in 2024 by Mathworks, any suggestions.
Accepted Answer
More Answers (0)
Categories
Find more on Colorbar in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






