Hello,
When I use the bar() plotting function, and input a given data set, for a particular binning (in the x-axis), the function plots the centers of the bins using the marker '*' on the x-axis, by default. I would like to remove these '*' marks on the x-axis. How do I write this in a code? I can do it using the GUI, but need it to be done via command line.
Regards,
F

 Akzeptierte Antwort

Star Strider
Star Strider am 10 Okt. 2014

2 Stimmen

I’ve seen this problem mentioned before. It is a default behaviour of bar. There is a posted fix for it here: How can I prevent or remove the asterisk annotations on my BAR plot in MATLAB 7.6 (R2008a)?

1 Kommentar

Fran
Fran am 10 Okt. 2014
Hi, yes this is what I was looking for thanks! This does the trick:
h = findobj(gca,'Type','line');
set(h,'Marker','none');

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 10 Okt. 2014

2 Stimmen

Is that a tick mark? You can get rid of x ticks doing something like this:
set(gca, 'xtick', []);
set(gca, 'xticklabels', []);
or something like that.

4 Kommentare

Fran
Fran am 10 Okt. 2014
Bearbeitet: Fran am 10 Okt. 2014
Hi, I meant these ticks (see image).
Your solution didn't work. Thanks anyway.
Image Analyst
Image Analyst am 10 Okt. 2014
Weird. I don't see those when I call bar().
The stars are an odd peculiarity of the 'histc' option... I'm not sure what the original programmer's motivation was, but if your bin widths are not even, markers are placed along the x-axis at each bin edge. The handle to this line object isn't returned, so you'll have to handle-dive to get rid of them:
delete(findobj('marker', '*'));
as Star mentioned above.
I'd be curious to know where this convention came from... I use the 'histc' option with bar all the time, but it is an undocumented legacy option (and is implemented via barV6.m, which "is undocumented and may change in a future release"), so I too discovered the * behavior accidentally.
Star Strider
Star Strider am 10 Okt. 2014
Bearbeitet: Star Strider am 10 Okt. 2014

Kelly — I believe I first learned about it from one of your posts.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 10 Okt. 2014

Bearbeitet:

am 10 Okt. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by