matlab绘图总结

1.怎样在坐标轴上设置自定义的标签

答:set(gca,'XTickLabel',{'FD001','FD002','FD003','FD004'});% 设置其余坐标区属性

matlab绘图总结_第1张图片

2.用text()显示plot函数的坐标点

(转:Matlab代码之plot函数的坐标点显示_横冲直撞de的博客-CSDN博客_matlab plot显示数据点)

//
clc;clear;close all;
x=1:8;
y1=x+2;
figure;subplot(1,2,1);plot(x,y2,'-*');title('图2:显示函数坐标点形式一');
xlabel('x');ylabel('y2');
str1=num2str(y2');text(x,y2,str1);
%文件名不能与matlab内置函数同名,不然运行失败。

subplot(1,2,2);plot(x,y2,'-*');title('图3:显示函数坐标点形式二');
xlabel('x');ylabel('y2');
for i=1:8
text(x(i),y2(i),['(',num2str(x(i)),',',num2str(y2(i)),')']);
end
%第二种形式的第二种表达方法
%str=[repmat('(',size(x,2),1),num2str(x') ...
%repmat(', ',size(x,2),1),num2str(y2'),repmat(')',size(x,2),1)]; 
%text(x,y2,cellstr(str));

matlab绘图总结_第2张图片 

 3.MATLAB绘制条形图并显示数值

转自:MATLAB绘制条形图并显示数值_zhangsangood的博客-CSDN博客_matlab柱状图显示数据

4.Matlab 图例 位置的不同命令

Matlab位置选择
一个简单的表格是这么创建的:

转自:Matlab 图例 位置的不同命令_VS洗发水的博客-CSDN博客_matlab图例位置

设置 位置
‘North’ inside plot box near top
‘South’ inside bottom
‘East’ inside right
‘West’ inside left
‘NorthEast’ inside top right (default for 2-D plots)
‘NorthWest’ inside top left
‘SouthEast’ inside bottom right
‘SouthWest’ inside bottom left
‘NorthOutside’ outside plot box near top
‘SouthOutside’ outside bottom
‘EastOutside’ outside right
‘WestOutside’ outside left
‘NorthEastOutside’ outside top right (default for 3-D plots)
‘NorthWestOutside’ outside top left
‘SouthEastOutside’ outside bottom right
‘SouthWestOutside’ outside bottom left
‘Best’ least conflict with data in plot
‘BestOutside’ least unused space outside plot

你可能感兴趣的:(matlab日常,matlab,开发语言)