["python","matplotlib","label"]
matplotlib y-axis label on right side

Is there a simple way to put the y-axis label on the right-hand side of the plot? I know that this can be done for the tick labels using ax.yaxis.tick_right(), but I would like to know if it can be done for the axis label as well. One idea which came to mind was to use ax.yaxis.tick_right() ax2 = ax.twinx() ax2.set_ylabel('foo') However, this doesn't have the desired effect of placing all labels (tick and axis labels) on the right-hand side, while preserving the extent of the y-axis. In short, I would like a way to move all the y-axis labels from the left to the right.
It looks like you can do it with: ax.yaxis.set_label_position("right") ax.yaxis.tick_right() See here for an example. To do the same with the plt. interface, use the plt.gca() function to expose the current axes, as this function does not seem to be exposed through any plt function. plt.gca().yaxis.set_label_position("right") plt.gca().yaxis.tick_right()