Reputation: 96458
When plotting on a figure in MATLAB, I have noticed that parts of the black box that holds the axes are missing (the left and bottom one):
I have tried issuing:
box off
box on
commands with no success. Do you know what I can do to get the corresponding black lines on the axes?
I am using the OpenGL renderer:
set(0,'DefaultFigureRenderer','opengl');
Upvotes: 7
Views: 11260
Reputation: 393
Being a perfectionist this bug bothered me for years! This is what seems to work, MATLAB R2013a:
set(0,'DefaultFigureRenderer','zbuffer')
I add a box just before I plot something and right after I finish plotting:
axes(handles.MyAxes);
cla;
hold off;
box on;
hold on;
% Do your plotting...
% scatter(...);
% plot(...);
% ...
box on;
I also noticed that if the first command is plot
then the bug may still be present. In this case I plot just a single point using scatter
with white color (makes it invisible) and then use plot
. That is, scatter(x(1),y(1),1,'MarkerEdgeColor','w','MarkerFaceColor','w')
and then plot(x,y,...)
.
My answer in fact refers to missing box lines when plotting in a GUIDE figure. I never had this issue when using a regular figure()
and then plot(...)
commands.
Hope it helps!
Upvotes: 0
Reputation: 11
Use the following line of code to make the black lines appear
set(gca,'Layer','top')
Upvotes: 1
Reputation: 21
Try increasing the line width of the axes a bit:
set(gca, 'LineWidth', 1.2)
Also, switching from hardware (default) to software rendering may solve the problem:
opengl software
However, there may be drawbacks. Increasing the line width, e.g., changes all axes lines, including ticks.
Upvotes: 2
Reputation: 19880
It looks like you have known issues with OpenGL renderer:
Let us know what you did exactly to create this figure.
Upvotes: 5