Matlab: How to plot without color graduation?

2020-05-06 12:29发布

问题:

My friend has made a script to handle a lot of data and plot various plots, however when he runs the script, the graphs have different colors according to the legend and when I do it, all graphs are similar with a color graduation from black to red! (see picture) Why does it differ and how do I get the graphs in different colors?

2D plot with color graduated graphs:-

figure
hold on
plot(sentar_7.created_at, sentar_7.acc_diff, '-');
plot(sentar_7.created_at, sentar_7.stand_toggle, '-');
plot(sentar_7.created_at, sentar_7.state, '-');
title('Sentar 7 acc')
xlabel('tid')
ylabel('dist [cm]')
legend('acc diff','stand toggle', 'state')
hold off

回答1:

This is a known issue with certain Intel graphics drivers. One potential workaround is to use basic hardware rendering:

opengl hardwarebasic

You could also disable the AlignVertexCenters property of the line object:

h = findall(gca, 'type', 'line')
set(h, 'AlignVertexCenters', 'off')

The best solution may be to update your graphics drivers to the 4380 version.