MATLAB: Using barh with hist option plotting extra points on plot

bar plotsbarhhistogramMATLAB

When plotting two sets of values using barh and specifying the locations of the bars, I get extra points plotted along the y-axis (see below), and I don't know why they're there.
The code that I use looks like this: barh(y,x,'hist') Where y is a vector of the y-values and x is a 2-column matrix for the bar values
When I plot without the hist option, the plot is normal without the extra points, but I need the bars to be at specific locations.

Best Answer

This is explained in the documentation for hist (and appears in one of the examples).

Paraphrasing the documentation, slightly, for clarity:

If you specify the bin intervals using a vector of unevenly spaced values, then the hist function uses the midpoints between consecutive values as the bin edges and indicates the specified values by markers along the x-axis.

Those are the markers you see. They are objects in the plot that you could remove after the fact:

rng 'default'
x = randn(1000,1);
figure
xbins3 = [-4 -2.5 0 0.5 1 3];
hist(x,xbins3)
h = get(gca,'Children');
set(h(1),'Marker','none')