MATLAB: Legend error (does not display ‘line’ in legend box)

errorfigurelegendlineplot

If I simply plot using the below code
x=0:0.1:10;
>> figure; plot(x,sin(x))
>> legend('on')
>> hold on
>> scatter(x, cos(x))
The figure looks like the below figure. The legend shows no 'line' for the first graph. It shows only circle.
How can I fix this problem?
untitled2.png

Best Answer

Using:
opengl('save','software')
seems to be a solution for that problem.
See: Use Software OpenGL for Future Sessions and related topics for details.