show baseline value on y-axis
1 view (last 30 days)
Show older comments
I have created a bar graph with a baseline. How do I get the value of the baseline to show on the y-axis?
1 Comment
Answers (1)
dpb
on 30 Apr 2018
If there isn't a tick at the baseline value, two choices-- following assumes have saved the necessary handles; hAx for axes object and hB for the bar plot.
- set and additional tick mark at that point--
ytk=hAx.YTick; % retrieve present tick marks
ytk=sort[hB(1).BaseValue ytk]; % add the base value and reorder
hAx.YTick=ytk; % and reset to new set
- use text to write a label at the desired location; this is more heuristic in that have to find the right x location to make the text align properly with the other labels but is conceptually not difficult although also have to write the numeric baseline value as string. Consequently, I'd suggest the former.
0 Comments
See Also
Categories
Find more on Graphics Object Properties 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!