Matlab绘图坐标轴的设置

上传人:博****1 文档编号:573221941 上传时间:2024-08-14 格式:PDF 页数:7 大小:203.69KB
返回 下载 相关 举报
Matlab绘图坐标轴的设置_第1页
第1页 / 共7页
Matlab绘图坐标轴的设置_第2页
第2页 / 共7页
Matlab绘图坐标轴的设置_第3页
第3页 / 共7页
Matlab绘图坐标轴的设置_第4页
第4页 / 共7页
Matlab绘图坐标轴的设置_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《Matlab绘图坐标轴的设置》由会员分享,可在线阅读,更多相关《Matlab绘图坐标轴的设置(7页珍藏版)》请在金锄头文库上搜索。

1、Matlab 绘图坐标轴的设置matlabmatlab 画图设置画图设置( (坐标轴、曲线、颜色坐标轴、曲线、颜色) )a=linspace(1,2,10)plot(a,-pr,linewidth,1.5,MarkerEdgeColor,r,MarkerFaceColor,m,MarkerSize,10)legend(a,Location,best)title(a,FontName,Times New Roman,FontWeight,Bold,FontSize,16)xlabel(T,FontName,Times New Roman,FontSize,14)ylabel(a,FontName

2、,Times New Roman,FontSize,14,Rotation,0)axis auto equalset(gca,FontName,Times New Roman,FontSize,14)1.曲线线型、颜色和标记点类型plot(X1,Y1,LineSpec, ) 通过字符串 LineSpec 指定曲线的线型、颜色及数据点的标记类型。线型颜色数据点标记类型标识符意义标识符意义标识符意义-实线r红色+加号-. 点划线g绿色o圆圈-虚线b蓝色*星号:点线c蓝绿色.点m洋红色x交叉符号y黄色square(或 s) 方格k黑色diamond(或 d) 菱形w白色向上的三角形v向下的三角形向左

3、的三角形向右的三角形pentagram(或 p) 五边形hexagram(或 h) 六边形2.设置曲线线宽、标记点大小,标记点边框颜色和标记点填充颜色等。plot(,Property Name, Property Value, )Property Name 意义选项LineWidth 线宽数值,如0.5,1等,单位为 pointsMarkerEdgeColor 标记点边框线条颜色颜色字符,如g, b等MarkerFaceColor 标记点内部区域填充颜色颜色字符MarkerSize 标记点大小数值,单位为 points3.坐标轴坐标轴设置范围设置:a. axis(xmin xmax ymin

4、ymax)设置坐标轴坐标轴在指定的区间b. axis auto 将当前绘图绘图区的坐标轴坐标轴范围设置为 MATLABMATLAB自动调整的区间c. axis manual 冻结当前坐标轴坐标轴范围,以后叠加绘图绘图都在当前坐标轴坐标轴范围内显示d. axis tight 采用紧密模式设置当前坐标轴坐标轴范围,即以用户数据范围为坐标轴坐标轴范围比例:a. axis equal 等比例坐标轴坐标轴b. axis square 以当前坐标轴坐标轴范围为基础,将坐标轴坐标轴区域调整为方格形c. axis normal 自动调整纵横轴比例,使当前坐标轴坐标轴范围内的图形显示达到最佳效果范围选项和比例设

5、置可以联合使用,默认的设置的设置为 axis auto normal4.坐标轴坐标轴刻度设置set(gca, XTick, 0 1 2) X坐标轴坐标轴刻度数据点位置set(gca,XTickLabel,a,b,c) X坐标轴坐标轴刻度处显示的字符set(gca,FontName,Times New Roman,FontSize,14)设置坐标轴坐标轴刻度字体名称,大小FontWeight,bold 加粗 FontAngle,italic 斜体对字体的设置的设置也可以用在 title, xlabel, ylabel等中5.图例legend(a,Location,best) 图例位置放在最佳位置

6、6.更多的设置的设置可以在绘图绘图窗口中打开绘图绘图工具,Inspector 中查找Various line types, plot symbols and colors may be obtained withPLOT(X,Y,S) where S is a character string made from one elementfrom any or all the following 3 columns:bblue.point-solidggreenocircle:dottedrredxx-mark-. dashdotccyan+plus- dashedmmagenta*star(n

7、one)no lineyyellowssquarekblackddiamondwwhitevtriangle (down)triangle (up)triangle (right)ppentagramhhexagram在使用 MatlabMatlab 时,经常需要将得到的数值表达成二维或三维图像。plot(vector1,vector2)可以用来画两个矢量的二维图,例如x=1:0.1:2*pi;plot(x,sin(x)可以画正弦函数在0-2pi 的上的图像。plot 函数可以接一些参数,来改变所画图像的属性(颜色,图像元素等) 。下面是一些属性的说明bblue(蓝色).point(点)-so

8、lid(实线)ggreen(绿色)ocircle(圆圈):dotted(点线)rred(红色)xx-mark(叉号)-.dashdot (点画线)ccyan(墨绿色)+plus(加号)-dashed(虚线)mmagenta(紫红色) *star(星号)(none) no lineyyellow(黄色)ssquare(正方形)kblack(黑色)ddiamond(菱形)vtriangle (down)triangle (up)triangle (right)ppentagramhhexagram例如,plot(x,y,.r)表示用点来画图,点的颜色是红色。plot 函数可以接一些参数,来改变所画

9、图像的属性(颜色,图像元素等) 。下面是一些属性的说明bblue(蓝色).point(点)-solid(实线)ggreen(绿色)ocircle(圆圈):dotted(点线)rred(红色)xx-mark(叉号)-.dashdot (点画线)ccyan(墨绿色)+plus(加号)-dashed(虚线)mmagenta(紫红色) *star(星号)(none) no lineyyellow(黄色)ssquare(正方形)kblack(黑色)ddiamond(菱形)vtriangle (down)triangle (up)triangle (right)ppentagramhhexagramExa

10、mplex = -pi:pi/10:pi;y = tan(sin(x) - sin(tan(x);plot(x,y,-rs,LineWidth,2,.MarkerEdgeColor,k,.MarkerFaceColor,g,.MarkerSize,10)xlabel(x);ylabel(y);用 Matlab 画图时,有时候需要对各种图标进行标注,例如,用“+”代表 A的运动情况,“*”代表 B 的运动情况。legend 函数的基本用法是LEGEND(string1,string2,string3, .)分别将字符串1、字符串2、字符串3标注到图中,每个字符串对应的图标为画图时的图标。例如:p

11、lot(x,sin(x),.b,x,cos(x),+r)legend(sin,cos)这样可以把.标识为sin,把+标识为cos还可以用 LEGEND(.,Location,LOC) 来指定图例标识框的位置这些是 Matlab help 文件。后面一段是对应的翻译和说明Northinside plot box near topSouthinside bottomEastinside rightWestNorthEastNorthWestSouthEastSouthWestNorthOutsideSouthOutsideEastOutsideWestOutsideNorthEastOutside

12、NorthWestOutsideSouthEastOutsideSouthWestOutsideBestBestOutsideNorthSouthinside leftinside top right (default)inside top leftinside bottom rightinside bottom leftoutside plot box near topoutside bottomoutside rightoutside leftoutside top rightoutside top leftoutside bottom rightoutside bottom leftle

13、ast conflict with data in plotleast unused space outside plot图例标识放在图顶端图例标识放在图底端East图例标识放在图右方West图例标识放在图左方NorthEast图例标识放在图右上方(默认)NorthWest图例标识放在图左上方SouthEast图例标识放在图右下角SouthWest图例标识放在图左下角(以上几个都是将图例标识放在框图内)NorthOutside图例标识放在图框外侧上方SouthOutside图例标识放在图框外侧下方EastOutside图例标识放在图框外侧右方WestOutside图例标识放在图框外侧左方Nor

14、thEastOutside图例标识放在图框外侧右上方NorthWestOutside 图例标识放在图框外侧左上方SouthEastOutside图例标识放在图框外侧右下方SouthWestOutside 图例标识放在图框外侧左下方(以上几个将图例标识放在框图外)Best图标标识放在图框内不与图冲突的最佳位置BestOutside图标标识放在图框外使用最小空间的最佳位置还是用上面的例子legend(sin,cos,location,northwest)可以将标识框放置在图的左上角。Examples:x = 0:.2:12;plot(x,bessel(1,x),x,bessel(2,x),x,be

15、ssel(3,x);legend(First,Second,Third);legend(First,Second,Third,Location,NorthEastOutside)b = bar(rand(10,5),stacked); colormap(summer); hold onx = plot(1:10,5*rand(10,1),marker,square,markersize,12,.markeredgecolor,y,markerfacecolor,.6 0 .6,.linestyle,-,color,r,linewidth,2); hold offlegend(b,x,Carrots,Peas,Peppers,Green Beans,.Cucumbers,Eggplant)

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号