Fill area inside a single curve with color without an outline?
6 次查看(过去 30 天)
显示 更早的评论
The data below form an almost-closed curve (the first column is "x" and the second is "y"). I'd like to fill it with color but can't figure out how. The "patch" examples I've found online all seem to use two curves except for the one at the link I added. However, it's too advanced for me and I don't understand how to use it.
patch(x, y,' b',' EdgeColor','none', 'FaceAlpha', 0.1)
This works. It gives me a filled shape. However, there's an outline and the
'EdgeColor','none'
does not get rid of it. I'd like to get rid of the outline and would also like to impose a gradient on the fill color so that it goes from nearly clear at one end to more opaque at the other. That's a secondary goal though. The main thing I want to do is get rid of the outline.
If anyone has any hints, I'd be very grateful!
3.538283063 300.2169197
3.712296984 321.9088937
3.886310905 345.7700651
4.118329466 373.9696312
4.350348028 402.1691974
4.66937355 434.7071584
4.901392111 462.9067245
5.133410673 478.0911063
5.510440835 504.1214751
5.945475638 527.9826464
6.351508121 549.6746204
6.757540603 571.3665944
7.308584687 595.2277657
8.033642691 621.2581345
8.613689095 640.7809111
9.251740139 662.472885
9.918793503 684.164859
10.52784223 701.5184382
11.28190255 736.2255965
11.65893271 747.0715835
11.86194896 773.1019523
12.15197216 783.9479393
12.58700696 794.7939262
13.10904872 805.6399132
13.45707657 814.3167028
13.77610209 822.9934924
14.44315545 838.1778742
14.84918794 849.0238612
15.34222738 859.8698482
15.98027842 875.0542299
16.44431555 883.7310195
16.79234339 890.2386117
17.14037123 896.7462039
17.48839907 905.4229935
17.80742459 909.7613883
18.387471 920.6073753
18.93851508 933.6225597
19.60556845 946.637744
20.35962877 961.8221258
20.91067285 972.6681128
21.49071926 983.5140998
22.04176334 992.1908894
22.44779582 1000.867679
22.47679814 1009.544469
21.63573086 1018.221258
21.63573086 1042.08243
21.75174014 1061.605206
22.07076566 1074.62039
22.70881671 1087.635575
23.72389791 1104.989154
24.12993039 1113.665944
24.18793503 1120.173536
23.92691415 1120.173536
23.57888631 1113.665944
22.79582367 1100.650759
22.59280742 1096.312364
21.89675174 1083.29718
21.46171694 1074.62039
20.91067285 1065.943601
20.70765661 1061.605206
20.09860789 1048.590022
19.92459397 1046.420824
19.51856148 1033.40564
19.57656613 1048.590022
19.80858469 1102.819957
20.01160093 1111.496746
19.80858469 1120.173536
19.08352668 1102.819957
18.90951276 1037.744035
18.47447796 1031.236443
18.15545244 1024.72885
16.61832947 994.3600868
15.19721578 961.8221258
12.70301624 903.2537961
12.38399072 894.5770065
12.15197216 888.0694143
11.94895592 885.9002169
11.65893271 896.7462039
11.02088167 879.3926247
9.889791183 846.8546638
8.236658933 794.7939262
7.714617169 777.4403471
7.366589327 801.3015184
6.26450116 749.2407809
6.061484919 736.2255965
5.829466357 736.2255965
5.423433875 768.7635575
4.75638051 807.8091106
5.278422274 849.0238612
5.626450116 870.7158351
5.394431555 877.2234273
5.104408353 857.7006508
4.582366589 816.4859002
4.292343387 792.6247289
3.886310905 749.2407809
3.567285383 705.856833
2.987238979 597.3969631
2.842227378 554.0130152
2.552204176 517.1366594
2.088167053 473.7527115
1.56612529 434.7071584
1.56612529 326.2472885
1.305104408 308.8937093
1.276102088 298.0477223
3.10324826 302.3861171
3.538283063 300.2169197
0 个评论
采纳的回答
Davide Masiello
2022-10-8
You should remove unnecessary spaces (' EdgeColor' --> 'EdgeColor').
A = [3.538283063 300.2169197
3.712296984 321.9088937
3.886310905 345.7700651
4.118329466 373.9696312
4.350348028 402.1691974
4.66937355 434.7071584
4.901392111 462.9067245
5.133410673 478.0911063
5.510440835 504.1214751
5.945475638 527.9826464
6.351508121 549.6746204
6.757540603 571.3665944
7.308584687 595.2277657
8.033642691 621.2581345
8.613689095 640.7809111
9.251740139 662.472885
9.918793503 684.164859
10.52784223 701.5184382
11.28190255 736.2255965
11.65893271 747.0715835
11.86194896 773.1019523
12.15197216 783.9479393
12.58700696 794.7939262
13.10904872 805.6399132
13.45707657 814.3167028
13.77610209 822.9934924
14.44315545 838.1778742
14.84918794 849.0238612
15.34222738 859.8698482
15.98027842 875.0542299
16.44431555 883.7310195
16.79234339 890.2386117
17.14037123 896.7462039
17.48839907 905.4229935
17.80742459 909.7613883
18.387471 920.6073753
18.93851508 933.6225597
19.60556845 946.637744
20.35962877 961.8221258
20.91067285 972.6681128
21.49071926 983.5140998
22.04176334 992.1908894
22.44779582 1000.867679
22.47679814 1009.544469
21.63573086 1018.221258
21.63573086 1042.08243
21.75174014 1061.605206
22.07076566 1074.62039
22.70881671 1087.635575
23.72389791 1104.989154
24.12993039 1113.665944
24.18793503 1120.173536
23.92691415 1120.173536
23.57888631 1113.665944
22.79582367 1100.650759
22.59280742 1096.312364
21.89675174 1083.29718
21.46171694 1074.62039
20.91067285 1065.943601
20.70765661 1061.605206
20.09860789 1048.590022
19.92459397 1046.420824
19.51856148 1033.40564
19.57656613 1048.590022
19.80858469 1102.819957
20.01160093 1111.496746
19.80858469 1120.173536
19.08352668 1102.819957
18.90951276 1037.744035
18.47447796 1031.236443
18.15545244 1024.72885
16.61832947 994.3600868
15.19721578 961.8221258
12.70301624 903.2537961
12.38399072 894.5770065
12.15197216 888.0694143
11.94895592 885.9002169
11.65893271 896.7462039
11.02088167 879.3926247
9.889791183 846.8546638
8.236658933 794.7939262
7.714617169 777.4403471
7.366589327 801.3015184
6.26450116 749.2407809
6.061484919 736.2255965
5.829466357 736.2255965
5.423433875 768.7635575
4.75638051 807.8091106
5.278422274 849.0238612
5.626450116 870.7158351
5.394431555 877.2234273
5.104408353 857.7006508
4.582366589 816.4859002
4.292343387 792.6247289
3.886310905 749.2407809
3.567285383 705.856833
2.987238979 597.3969631
2.842227378 554.0130152
2.552204176 517.1366594
2.088167053 473.7527115
1.56612529 434.7071584
1.56612529 326.2472885
1.305104408 308.8937093
1.276102088 298.0477223
3.10324826 302.3861171
3.538283063 300.2169197];
x = A(:,1);
y = A(:,2);
patch(x, y,'b','EdgeColor','none','FaceAlpha', 0.1)
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!