I want to show the result of a PCC test. I have two y axes to show the r and p-value respectively. I plot a horizontal dashed line on the second axis to indicate the threshold value p=0.05
and I want to add another ytick lable (or other label as long as it's in the right location, such as the red 0.05 in the picture below) to the second y axis while keeping the original ytick labels.
According to matplotlib documentation
CodePudding user response:
You can add a text outside the plot. The
Alternatively, you could set a minor tick with a label:
ax2.set_yticks([0.05], minor=True)
ax2.set_yticklabels([0.05], minor=True, color='r', fontsize=18)