How do I vary the color of a line with time when the X and Y data overlap?
1 次查看(过去 30 天)
显示 更早的评论
I'm collecting data from some extensometers that show soil displacements in response to barometric pressure fluctuations. When the displacement data is plotted against the barometric data (to get a coefficient), the plot appears like a series of "squiggles" (see photo). When I use the patch() function, the polygons are filled in with color. I only want the color of the line to vary with time. Does anyone know how to accomplish this? I've tried surf(), but was unable to plot.
x = BaroP_Avg; % Barometric Pressure Data [kPa] y = X8; % Displacement Data [microns] col = time; figure();patch(x,y,col);
Thanks, Rob
0 个评论
回答(1 个)
Renee Coetsee
2017-3-23
The documentation for "patch" has an example on how to create a multicolored line. It works by setting the last entry of y to NaN so that patch creates a line instead of a closed polygon, then setting the 'EdgeColor' patch property. You can see more details in the "Create Multicolored Line" example in the patch documentation page:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!