资源描述:
《MATLAB绘图坐标操作.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1、坐标轴删除set(gca,'xtick',[])%去掉x轴的刻度set(gca,'ytick',[])%去掉xy轴的刻度set(gca,'xtick',[],'ytick',[])%同时去掉x轴和y轴的刻度2、Matlab中“坐标轴刻度”的不同风格 x=1:8;subplot(2,2,1)plot(x)%tickstyle0(auto)subplot(2,2,2)plot(x)set(gca,'xtick',[1368]);%style1set(gca,'ytick',[]);%style2subplot
2、(2,2,3)plot(x)set(gca,'xtick',[1368]);set(gca,'xticklabel',sprintf('.4f
3、',get(gca,'xtick')));%style3set(gca,'ytick',[2457]);set(gca,'yticklabel',{'Two','Four','Five','Seven'});%style4subplot(2,2,4)plot(x)set(gca,'xminortick','on');%style5set(gca,'ticklength
4、',[0.050.025]);%style6set(gca,'tickdir','out');%style7另附Maltab坐标调整程序一段:x=20:10:20000;y=rand(size(x));semilogx(x,y);set(gca,'XLim',[2020000]);set(gca,'XMinorTick','off');set(gca,'XTick',[2031.563125250500100020004000800016000]);set(gca,'XGrid','on');set(gca,
5、'XMinorGrid','off'); 3、matlab坐标刻度调整subplot(3,2,1)plot(x)title('默认格式')subplot(3,2,2)plot(x)set(gca,'xtick',[1368]);set(gca,'ytick',[]);title('X自定义间隔,Y关闭')subplot(3,2,3)plot(x)set(gca,'xtick',[1368]);set(gca,'xticklabel',sprintf('.4f
6、',get(gca,'xtick')))set(g
7、ca,'ytick',[2457]);set(gca,'yticklabel',{'Two','Four','Five','Seven'});title('XY自定义间隔、精度及显示方式')subplot(3,2,4)plot(x)set(gca,'xminortick','on');%style5set(gca,'ticklength',[0.050.025]);set(gca,'tickdir','out');title('XY坐标刻度显示方式')subplot(3,2,5)plot(x)set(gca,
8、'xtick',[min(x)(max(x)+min(x))/2max(x)]);set(gca,'ytick',[min(x)(max(x)+min(x))/2max(x)]);title('论文中常用的标准3点式显示')x=20:10:20000;y=rand(size(x));subplot(3,2,6)semilogx(x,y);set(gca,'XLim',[2020000]);set(gca,'XMinorTick','off');set(gca,'XTick',[2031.56312525050
9、0100020004000800016000]);set(gca,'XGrid','on');set(gca,'XMinorGrid','off');title('自定义网格显示')%%%%%%%%%%%%%%%%%%%%%%%顺便附上可以格式化坐标刻度的程序段x=get(gca,'xlim');y=get(gca,'ylim');set(gca,'xtick',[x(1)(x(1)+x(2))/2x(2)]);set(gca,'ytick',[y(1)(y(1)+y(2))/2y(2)]);--------
10、-----get(gca,'xlim');是获取最大最小刻度的如果需要获取所有在坐标轴上显示的刻度,需要使用get(gca,'ytick')