MATLAB Answers

Changing the histogram edge color from the default green gradient.

25 views (last 30 days)
Hi Guys, I am having problems with the standard histogram function in Matlab 2015b.
The edges are colored with a green gradient and I cannot change it.
Example: x = randn(10000,1); h = histogram(x);
This is the output:
According to Documentation (<http://de.mathworks.com/help/matlab/ref/histogram.html>) I should get black edges. h.EdgeColor is [0, 0, 0] by the way and changing has no influence on the appearence.

  3 Comments

Rick Rosson
Rick Rosson on 2 Apr 2016
What is the make and model of your computer? What operating system are you using? Which version?
Andreas Haselsteiner
Andreas Haselsteiner on 4 Apr 2016
A 20BWS40E00 Lenovo notebook with Windows 10. Your command "opengl software" did the trick. Thanks.
Duijnhouwer
Duijnhouwer on 4 Jun 2016
I had the exact same problem on Matlab 8.6.0.267246 (R2015b) running on a Dell Intel core i5-4570S CPU, 64-bit Windows 10. The command "opengl software" solved it (thanks Rick Rosson!). "opengl hardwarebasic" also removed the green gradient and might preserve some hardware acceleration (although on my computer it makes all lines appear a bit fuzzy)

Sign in to comment.

Accepted Answer

Rick Rosson
Rick Rosson on 2 Apr 2016
The problem is with the renderer. Please try the following:
opengl software
and then re-plotting.

  0 Comments

Sign in to comment.

More Answers (2)

Image Analyst
Image Analyst on 2 Apr 2016
Perhaps increase the edge width:
x = randn(10000,1);
h = histogram(x, 'EdgeColor', 'k', 'LineWidth', 2);
I don't see it so it could be an issue with your video adapter. I think I recall such a thing about 2-3 weeks ago and it was the poster's video adapter. Perhaps changing the renderer might help.
fig = figure;
x = randn(10000,1);
h = histogram(x, 'EdgeColor', 'k', 'LineWidth', 2);
% fig.Renderer = 'opengl';
fig.Renderer = 'painters';

  0 Comments

Sign in to comment.


Sign in to answer this question.