|
| 1 | +# Fill Between Area Curve |
| 2 | + |
| 3 | +[]() |
| 4 | + |
| 5 | +Version 1.0 |
| 6 | + |
| 7 | +<img src="examplePic.png"> |
| 8 | + |
| 9 | +## Description |
| 10 | +The Fill Between Area Curve creates a shaded area between two data series, effectively highlighting the region of overlap or difference. |
| 11 | + |
| 12 | +## Dependencies |
| 13 | +For optimal performance and accurate graphs, please install the <b> Mapping Toolbox </b>. |
| 14 | + |
| 15 | +## Syntax |
| 16 | +* `fillBetweenAreaCurve(x, y1, y2)` shades the area between 2 lines formed by y1 and y2 |
| 17 | +* `fillBetweenAreaCurve(x, y1, y2, c)` shades the area between 2 lines formed by y1 and y2 with color c. |
| 18 | +* `fillBetweenAreaCurve(__, Name, Value)` specifies additional options for the FillBetweenAreaCurve using one or more name-value pair arguments. Specify the options after all other input arguments. |
| 19 | + |
| 20 | +## Name-Value Pair Arguments/Properties |
| 21 | + |
| 22 | +* `XData` Array containing values of x-coordinates for both plots y1 and y2. <b> Note: x-coordinates for both y1 and y2 should be common </b> |
| 23 | +* `Y1Data` y-coordinates of y1 plot |
| 24 | +* `Y2Data` y-coordinates of y2 plot |
| 25 | +* `Condition` The condition property selectively shades the area based on the condition provided by the user. |
| 26 | +* `ShadeInverse` Shades all the unshaded regions between 2 curves with a different color. |
| 27 | +* `OptimizePerformance` Calculate the vertices of triangles that compose the patch manually instead of asking patch to do it |
| 28 | +## Stylistic Name-Value Pair Arguments/Properties |
| 29 | + |
| 30 | +* `FaceAlpha` Describes opacity of shaded area. If set to 1, the shaded area is completely opaque. If set to 0, the shaded area is completely transparent. |
| 31 | +* `FaceColor` Describes the color of shaded area specified by Condition |
| 32 | +* `InverseFaceColor` If ShadeInverse is set to true, we shade the unshaded region with InverseFaceColor |
| 33 | +* `Line1Color` Line color for plot describing y1 values |
| 34 | +* `Line2Color` Line color for plot describing y2 values |
| 35 | +* `XLabel` Label for x axis |
| 36 | +* `YLabel` Label for y axis |
| 37 | +* `Line1LineStyle` Line Spec for plot describing y1 values |
| 38 | +* `Line2LineStyle` Line Spec for plot describing y2 values |
| 39 | +* `Line1LineWidth` Line Width for plot describing y1 values |
| 40 | +* `Line2LineWidth` Line Width for plot describing y2 values |
| 41 | +* `Label1` Label for plot describing y1 values |
| 42 | +* `Label2` Label for plot describing y2 values |
| 43 | +* `Title` Title of the chart |
| 44 | + |
| 45 | + |
| 46 | +### How to use |
| 47 | + |
| 48 | +``` |
| 49 | +% Intialize some data |
| 50 | +x = linspace(0, 4 * pi, 20); |
| 51 | +y_sinx = sin(x); |
| 52 | +y_cosx = cos(x); |
| 53 | +
|
| 54 | +% Create a basic FillBetweenAreaCurve |
| 55 | +areaCurve = fillBetweenAreaCurve(x, y_sinx, y_cosx); |
| 56 | +
|
| 57 | +% Create a basic FillBetweenAreaCurve with magneta shading |
| 58 | +areaCurveMagneta = fillBetweenAreaCurve(x, y_sinx, y_cosx, 'm'); |
| 59 | +
|
| 60 | +
|
| 61 | +% Create a FillBetweenAreaCurve with selective shading |
| 62 | +areaCurveSelectiveShading = fillBetweenAreaCurve(x, y_sinx, y_cosx, 'Condition', @(x, y1, y2) x > 2 & x < 4); |
| 63 | +areaCurveCondition2.ShadeInverse = false; |
| 64 | +
|
| 65 | +``` |
0 commit comments