美文网首页
Matlab画图入门课

Matlab画图入门课

作者: 爱学习的张小路 | 来源:发表于2017-05-26 10:02 被阅读0次

basic plot

x=0:0.01:2*pi;
y=sin(x);
figure;
plot(x,y);

basic plot

line style

x=0:0.01:2*pi;
y=sin(x);
y1=sin(x-0.5);
y2=sin(x-1);
y3=sin(x-1.5);
figure;
plot(x,y,'-',x,y1,'--',x,y2,':',x,y3,'-.');

line style

LineSpec(Color)

x=0:0.01:2*pi;
y=sin(x);
y1=sin(x-0.5);
y2=sin(x-1);
y3=sin(x-1.5);
figure;
plot(x,y,'-y',x,y1,'--m',x,y2,':c',x,y3,'-.g');

Color

LineSpec(Marker)

x=0:0.01:2pi;
y=sin(x);
y1=sin(x-0.5);
figure;
plot(x,y,'-
r',x,y1,'--db');

由于点太密集,所以线条变粗

Solution

x=0:0.01:2pi;
y=sin(x);
y1=sin(x-0.5);
mInds=round(linspace(1,length(x),10));
figure;
plot(x,y,'-r',x,y1,'--b');
hold on;
plot(x(mInds),y(mInds),'
r',x(mInds),y1(mInds),'db');

Marker

others

x=0:0.01:2pi;
y=sin(x);
y1=sin(x-0.5);
figure;
plot(x,y,'-r',x,y1,'--b','LineWidth',1.5); %设置线宽
xlabel('Angle'); %设置横坐标名称
ylabel('Amplitude'); %设置纵坐标名称
legend('sin(x)','sin(x-0.5)'); %设置图例
axis([0,2
pi,-1,1]); %设置坐标轴宽度
grid on; %添加网格线
title('My second MATLAB olot'); %添加图名
set(gca,'FontSize',18); %设置字体大小
set(gca,'Xtick',linspace(0,2*pi,5),'XtickLabel',{'0','0.5\pi','\pi','1.5\pi','2\pi'});%设置刻度标签

mapping

bar Chart

figure;
bar(industry);
axis([0,19,0,900]);
set(gca,'XTick',1:18);
title('three industry of He Nan');
xlabel('district');
ylabel('output value');
legend('primary industry','secondary industy','tertiary industry');
set(gca,'FontSize',18);

河南省三大产业

Stacked Bar Chart

figure;
bar(industry,'stacked');
axis([0,19,0,2100]);
set(gca,'XTick',1:18);
title('three industry of He Nan');
xlabel('district');
ylabel('output value');
legend('primary industry','secondary industy','tertiary industry');
set(gca,'FontSize',16);

河南省三大产业堆叠图

相关文章

  • Matlab画图入门课

    basic plot x=0:0.01:2*pi;y=sin(x);figure;plot(x,y); line ...

  • Python中好用的可视化库

    入门款:Matplotlib 在Python中实现matlab画图效果的库,可以绘制。适合论文绘图。相关画图教程在...

  • Matlab 画图

    MATLAB 操作总结 如何用命令行保存图片? saveas   用法:saveas( fig, filename...

  • matlab 画图

    字体- FontName 字体大小 - FontSize 设置坐标轴字体 直接在图后 set(gca,'FontS...

  • MATLAB画图

    忘记谁大谁小了,matlab画一个图就好了 正确 错误

  • Matlab怎么用?matlab视频教程matlab图像处理视频

    Matlab怎么用?matlab视频教程matlab图像处理视频教程零基础入门matlab教程视频 MATLAB有...

  • 2018-05-25

    matlab 画图线形 Solid line (default)-- Dashed line: Dot...

  • matlab参考

    matlab入门学习参考网站 matlab-W3Cschoolmatlab-易百教程

  • 使用Matlab画图

    需求 绘制栅格(矩阵)颜色图 参考网站 显示颜色函数imagesc设置颜色函数colormap设置颜色栏函数col...

  • matlab 画图函数

    整理matlab 画图函数 %借用一段代码来说明 [xx,yy] = ndgrid(linspace(xmin, ...

网友评论

      本文标题:Matlab画图入门课

      本文链接:https://www.haomeiwen.com/subject/jmetfxtx.html