# matlab 画图

## 折线图

```    legend(...,'Location',LOC) adds a legend in the specified
location, LOC, with respect to the axes.  LOC may be either a
1x4 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```

`set(gca,'xtick',开始:两个点之间:结束);`

## 直方图

matlab 柱状图填充图案可以使用 applyhatch 画图，下面将告诉大家如何做

```    close all
clear all
clc
% The computer journal paper
% Jigang Wu etc.

% 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'); % 设置背景颜色为白色,否则坐标轴出现区域的颜色为灰色
applyhatch(gcf,'\.x.');```

```    y=[559006 ,2269384,783762;508559 ,2140905,696001;506491,2007763,735464]
bar(y,0.6)

legend('n','N','l')
grid on;
set(gca,'XTickLabel',{'第一次','第二次','第三次'})

xlabel('匹配次数')

ylabel('结果数')

set (gcf,'Position',[500,500,500,500], 'color','w')

applyhatch(gcf,'\.x./');

set(gcf,'Color','w'); ```

Matlab绘图高级部分

688 篇文章34 人订阅

0 条评论

## 相关文章

3815

### Bootstrap响应式前端框架笔记十六——模态框交互

模态框也可以称为弹出窗，其作用是当用户点击某个功能按钮后，在网页上弹出一个内容窗口。在Bootstrap中，创建模态框十分简单。首先模态框组件通过mod...

1031

### Golang中image/jpeg包和image/png包用法

jpeg包实现了jpeg图片的编码和解码 func Decode(r io.Reader) (image.Image, error) //Decode读取一...

6804

1912

22910

2K0

2653

2232

761

1627