show baseline value on y-axis

1 view (last 30 days)
Kantave Greene
Kantave Greene on 30 Apr 2018
Answered: dpb on 30 Apr 2018
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
Ameer Hamza
Ameer Hamza on 30 Apr 2018
Can you show a picture example of what are you trying to do?

Sign in to comment.

Answers (1)

dpb
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.

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!