MATLAB 线型图

MATLAB 线型图

基本设置

线形

-    Solid line (default)
--   Dashed line
:     Dotted line
-.   Dash-dot line

颜色

r  Red
g  Green
b   Blue
c   Cyan
m  Magenta
y  Yellow
k   Black
w  White

数据点的形状

+  Plus sign
o  Circle
*  Asterisk
.  Point 
x    Cross
'square' or s    Square 
'diamond' or d    Diamond
^  Upward-pointing triangle
v   Downward-pointing triangle
>  Right-pointing triangle
'pentagram' or p    Five-pointed star (pentagram)
'hexagram' or h     Six-pointed star (hexagram)

example

plot(N_set, powerSet, 'r--^', 'LineWidth',1.5,'MarkerSize',8);
hold on;
plot(N_set, s_powerSet, 'b-.o','LineWidth',1.5,'MarkerSize',8);
plot(N_set, c_powerSet, 'm-v','LineWidth',1.5,'MarkerSize',8);
plot(N_set, no_powerSet, 'k--*','LineWidth',1.5,'MarkerSize',8);

set(gca,'xtick', N_set);
xlabel('N'); ylabel('P (dBm)');
handle=legend('alg 1', 'alg 2', 'alg 3', 'baseline');

grid on;
% set(handle, 'Interpreter', 'LaTex');
set(handle, 'FontSize', 12, 'Location', 'best');
set(gca, 'FontSize', 12);

经典配色

plot(x, y, '--s', 'Color', [0  0  0], 'linewidth', 2); % 黑
plot(x, y, '--o',' Color', [0  0  1], 'linewidth', 2); % 蓝
plot(x, y, '--^',' Color', [1  0  0], 'linewidth', 2); % 红
plot(x, y, '--d',' Color', [0.13   0.55   0.13], 'linewidth', 2); % 绿
plot(x, y, '--x',' Color', [1  0  1], 'linewidth', 2); % 品红
plot(x, y, '--+',' Color', [0.25   0.88   0.82], 'linewidth', 2); % 青
plot(x, y, '-->',' Color', [0.6   0.2   0.98], 'linewidth', 2); % 紫

https://zhuanlan.zhihu.com/p/25912843

默认配色

从 MATLAB 2014b 开始,其 plot 函数的默认颜色有所调整。https://bigbossjiang.top/2016/2016-07-19-MATLAB-plot-color/
新的默认配色名称为 parula,意为北美生活的一种森莺。
如果想了解 parula 的配色方案,可以在 MATLAB 中输入以下命令:

get(gca,'colororder')

美化

http://vra.github.io/2015/05/31/matlab-plot/

查表

1

2

猜你喜欢

转载自blog.csdn.net/qq_23947237/article/details/103163551
今日推荐