MATLAB Answers

Get boundary object from a bar plot

2 views (last 30 days)
Is there a way to get a line/ patch object from a bar plot, if there even is such object in a bar plot?
I'm trying to implement "hatch" (https://se.mathworks.com/matlabcentral/fileexchange/2075-hatch-m) together with "bar" but can't extract the expected object, not even:
findobj(b(1), 'Type', 'patch')
works...
Is it simply so that bar does not contain what I search for and I have to forfit my attempts at "hatching" the bars?

  0 Comments

Sign in to comment.

Accepted Answer

Mario Malic
Mario Malic on 5 Nov 2020
It looks like such object does not exist on bar anymore.

  5 Comments

Show 2 older comments
Kristoffer Clasén
Kristoffer Clasén on 6 Nov 2020
Aaaand it seems I don't have EndPoints in my release either, but perhaps it works with YData/XData instead.
I also realize a problem in that I have errorbars as well so I assume I have to chop up the errorbarbar function and plot the errorbars after patching/ hatching to not cover them.
Thanks Mario
Mario Malic
Mario Malic on 6 Nov 2020
It should properly work with mentioned properties and yes, errorbar comes after patching.
You're welcome.
Kristoffer Clasén
Kristoffer Clasén on 6 Nov 2020
I just found hatchfill2 which appears to accept bar as object input, and I also found a thread with an example of how to "hatch" the legend which also was a concern:
So I'll most likely continue with this option

Sign in to comment.

More Answers (0)

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!