方法/步骤 1 首先,我们创建六条曲线,分两次绘制曲线x = 0 : 0.01 : 4*pi;y1 = sin(x);y2 = cos(x);y3 = 3*cos(x);y4 = cos(x).*sin(x);y5 = cos(x) + sin(x);y6 = cos(x) - 2*sin(x);h1 = plot(x,y1,x,y2,x,y3);hold onh2 = plot(x,y4,x,y5,
二、legend 函数标注图形 三、图形修饰 一、plot 函数绘制多个图形 使用单个 plot 函数绘制多条曲线 : plot 函数可以传入多个可变参数 , 三个变量一组 , 每一组中 ; 第一个变量是 x 轴向量 ; 第二个变量是 y 轴向量 ; 第三个变量是 线条设定字符串 ; 代码示例 : 代码语言:javascript 代码运行次数:0 ...
This is one legend for the different lines. I think it is not clear what you want. Is this it? 댓글 수: 1 andrew 2014년 3월 7일 This is my plot I have 2 lines with the same color, I'm wondering how to create a legend representing each line once. 댓글을 달...
plot(x, y1, '--or', x, y2, '^g:'); 1. 2. 3. 4. 5. 6. 7. 8. 执行效果 : 二、legend 函数标注图形 legend 函数 , 传入若干个字符串可变参数 , 系统会按照顺序为若干图形进行标识 ; 如上面的示例中 , 给第一个图形标识 sin(x) , 给第二个图形标识 cos(x) ; 代码示例...
在作图命令中(plot)给出图例标签; Plot two lines. Specify the legend labels during the plotting commands by setting the DisplayName property to the desired text. Then, add a legend. 画两条线。 通过将DisplayName属性设置为所需文本,在绘图命令期间指定图例标签。 然后,添加一个图例(legend)。
legend函数的基本用法是 LEGEND(string1,string2,string3, ...) 分别将 字符串1、 字符串2、字符串3标注到图中,每个字符串对应的图标为画图时的图标。 例如: plot(x,sin(x),'.b',x,cos(x),'+r') legend('sin','cos')这样可以把"."标识为'sin',把"+"标识为"cos" ...
% 准备绘图变量 x = 0 : pi / 20 : 2 * pi; y1 = sin(x); y2 = cos(x); % 绘制 sin 曲线, 红色 + 圆圈 + 虚线 % 绘制 cos 曲线, 绿色 + 三角 + 冒号线 plot(x, y1, '--or', x, y2, '^g:'); % 按照顺序标识标识图形 legend('sin(x)', 'cos(x)'); % 添加标题 title...
plot(x,y21,'b-') xlabel('方向') ylabel('能量') legend('草地','公路') set(legend,'edgecolor','none') legend('boxoff') %legend无边框 %--- subplot(2,2,2);plot(x,y12,'r-') hold on plot(x,y22,'b-') xlabel('方向') ...
plot(x,y21,'b-') xlabel('方向') ylabel('能量') legend('草地','公路') set(legend,'edgecolor','none') legend('boxoff') %legend无边框 %--- subplot(2,2,2);plot(x,y12,'r-') hold on plot(x,y22,'b-') xlabel('方向') ...
二、legend 函数标注图形 三、图形修饰 一、plot函数绘制多个图形 使用单个 plot 函数绘制多条曲线 :plot 函数可以传入多个可变参数 , 三个变量一组 , 每一组中 ; 第一个变量是 x 轴向量 ; 第二个变量是 y 轴向量 ; 第三个变量是 线条设定字符串 ; ...