use fill but not legend
时间: 2024-03-18 19:38:35 浏览: 61
$GOPATH/go.mod exists but should not goland
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.
阅读全文