Here's an example of creating a pair of axes, one with a histogram and one with a line.
x = randn(1, 1e5);
h = histogram(x);
binvalues = h.BinCounts;
binedges = h.BinEdges;
bincenters = (binedges(1:end-1)+binedges(2:end))/2;
plot(bincenters, binvalues, '--')
You should see that the line on the right axes touches the histogram bars at their centers.
If you are using yyaxis and unable to show both the histogram and the other curve, can you show a small sample of your code that tries to show the other curve?