use fill but not legend
时间: 2024-03-18 17:38:35 浏览: 26
If you want to label the filled area itself without using a legend in MATLAB, you can use the `text` function to add a label directly to the plot. Here's an example:
```matlab
x = 0:pi/100:2*pi;
y1 = sin(x);
y2 = cos(x);
fill([x fliplr(x)], [y1 fliplr(y2)], 'r');
text(mean(x), mean([y1, y2]), 'Filled area', 'HorizontalAlignment', 'center');
```
In this code, the `fill` function is used to create a filled area plot with a red color. Then, the `text` function is used to add the label "Filled area" to the center of the plot using the mean value of the `x` and `y` coordinates. The `'HorizontalAlignment', 'center'` argument is used to center the label horizontally. You can adjust the position and style of the label by adjusting the arguments to the `text` function.
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)