I am new to matplotlib. I've been able to put together the following plot:
I did the axis tick labels on the left using:
plot.yticks([n + 0.5 for n in range(len(endIDs))], endIDs)
I found that I had to add to the 0.5, to get it to center better. But only when the entries got to be a lot, I'm not sure why. But what I want is to have a corresponding axis on the right side that prints some info. I chose to just have a loop that looked like:
plot.text(1.0, (index + 0.5) / len(endIDs), eachText, horizontalalignment='left', verticalalignment='center', transform=ax.transAxes)
But they don't quite line up. What is the best technique to use to get the labels on the right to line up with the tick marks on the left? I don't actually need a second axes, I just want the same axis/ticks on the right, but with different labels.
(I'm using Python3 if that matters)
UPDATE
Rather than use pyplot.yticks
and a bunch of text
placements, I've now moved to the following:
fig, axLeft = plot.subplots()
axLeft.set_yticks(range(len(endIDs)))
axLeft.set_yticklabels(endIDs)
axRight = axLeft.twinx()
axRight.set_yticks(range(len(endIDs)))
axRight.set_yticklabels(missRates)
Unfortunately, it still produces output similar to the above where the left side seems to have inset on the ends and lines up with the actual plot series, but the right side is stretched from corner to corner with no inset. Which is weird because I gave both axes the exactly same set_yticks
argument.