当前位置:网站首页>matlab drawing
matlab drawing
2022-08-04 21:05:00 【Lin Dexi】
This article describes how to use matlab to draw.This article includes: line chart x-axis and y-axis, title, legend Column chart fill pattern
Line Chart
How does matlab set the distance between the legend and the x-axis of the graph in the next section
The legend of the line chart needs to know the Legend, which can be set using him
legend(...,'Location',LOC) adds alegend in the specifiedlocation, LOC, with respect to the axes. LOC may be either a1x4 position vector or one of the following strings:'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
How to set the x-axis size?
It can be set by set(gca,'xtick',1:1:100);
code setting starts from 1 and ends at 100, explain
set(gca,'xtick',start:between two dots:end);
Histogram
How to draw a bar chart and how to fill the bar chart with different patterns?
Matlab histogram fill pattern can be drawn using applyhatch, the following will tell you how to do it
The first step is to copy the file applyhatch.m
to your computer.About where to download applyhatch.m
, please Baidu, if you can't find it, you can contact me at [email protected]
Don't tell in herenext
The second step is to copy the file to the workbench. What is the workbench is the folder path opened by the software. The path is as shown below
You can modify it yourself, just put the above files in this folder.
The usage is applyhatch(gcf,'\.x.');
The second parameter is to use a different pattern, you can add '/', '\', '|', '-', '+', 'x', '.'
several characters
Example:
close allclear allclc% The computer journal paper% Jigang Wu etc.% copyright: [email protected]% data = [31,32,35;72,73,75;113,114,117;144,146,147;171,173,174;213,215,220];data =[16,17,18;33,34,37;51,54,55;71,74,74;86,91,91;105,113,113];bar(data,1);axis([0 7 0.0 150]);legend('DPA','TSRP','GRP',0);grid on;set(gca,'XTickLabel',{'100','200','300','400','500','600'});xlabel('The number of internal nodes');ylabel('The number of replica that created');set(gcf,'Color','w'); % Set the background color to white, otherwise the color of the area where the coordinate axis appears is grayapplyhatch(gcf,'\.x.');
For different combinations of histograms, use data=[data 1.1, data 1.2, data 1.3; data 2.1, data 2.2...]
Then draw it, use bar(data,1);
The second parameter is the width, try to modify the second value and run it.
The legend can be used. The legend of matlab uses legend('DPA','TSRP','GRP',0);
to add the corresponding legend as much as there is data.
Try the following code:
y=[559006 ,2269384,783762;508559 ,2140905,696001;506491,2007763,735464]bar(y,0.6)legend('n','N','l')grid on;set(gca,'XTickLabel',{'first','second','third'})xlabel('Number of matches')ylabel('Number of results')set (gcf,'Position',[500,500,500,500],'color','w')applyhatch(gcf,'\.x./');set(gcf,'Color','w');
If you encounter problems with the process, you can contact me.
Thanks to Brother Chen Long for his help.
边栏推荐
猜你喜欢
随机推荐
【2022杭电多校5 1012题 Buy Figurines】STL的运用
面试官:Redis中过期的key是怎么被删除的?
LINQ to SQL (Group By/Having/Count/Sum/Min/Max/Avg操作符)
Matlab画图2
3. Byte stream and character stream of IO stream
PRIMAL: Pathfinding via Reinforcement and Imitation Multi-Agent Learning 代码解析
mdk5.14无法烧录
Comic | Two weeks after the boss laid me off, he hired me back and doubled my salary!
dotnet 删除只读文件
SAP ABAP OData 服务如何支持 $select 有选择性地仅读取部分模型字段值试读版
3、IO流之字节流和字符流
After encountering MapStruct, the conversion between PO, DTO and VO objects is no longer handwritten
关于 SAP 电商云 Spartacus UI SSR 的 state transfer 问题
漫画 | 老板裁掉我两周后,又把我请回去,工资翻番!
如何进行AI业务诊断,快速识别降本提效增长点?
路由中的meta、params传参的一些问题(可传不可传,为空,搭配,点击传递多次参数报错)
About the state transfer problem of SAP e-commerce cloud Spartacus UI SSR
win10 uwp 修改图片质量压缩图片
经验分享|盘点企业进行知识管理时的困惑类型
2、字符集-编码-解码