I have found this in the meantime and will try to work through that and let myself know if it works
Plot transparent area of max and min on line graph
1 view (last 30 days)
Show older comments
I have a line graph with max and min plotted as points. I want to turn those points instead into a transparent area that highlights max and min. My code works, mostly.
Problem: area() only plots from zero either up or down. This is fine if my max is positive and my min value is negative. If my max AND min value are both positive, then it overlaps the plots and makes them 1/2 as transparent if that makes sense. Below is code that works except during cases pointed out
if true
% Plotting max and min as transparent area in background
p1=area(year,max);
p2=area(year,min);
childp1=get(p1,'Children');
childp2=get(p2,'Children');
set(childp1,'FaceAlpha',0.05) %transparency between 0 to 1
set(childp2,'FaceAlpha',0.05)
What I tried to do to fix it is combine max and min into matrix and plot that into an area with this
if true
% Plotting max and min as transparent area in background
maxmin = [min.',max.']; %.' to transpose, maybe not necessary
p=area(year,maxmin);
childp=get(p,'Children');
set(childp,'FaceAlpha',0.05) %transparency between 0 to 1
I get the error: Conversion to double from cell is not possible.
The transpose is just to change my max min I pull from csv file. Thank you!
2 Comments
Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!