我正在尝试在轴的右侧添加一个额外的轴标签,但不需要记号或记号标签。你知道吗
import pandas as pd
import matplotlib.pyplot as plt
fig, axs = plt.subplots(2,2,sharey=True,sharex=True)
for i in range(2):
for j in range(2):
pd.Series(np.random.random(10)).plot(ax=axs[i,j])
axs[0,j].set_title('j = {}'.format(j))
ax[1,j].set_ylabel('x')
secaxy = axs[i,1].secondary_yaxis('right')
secaxy.set_ylabel('i = {}'.format(i))
secaxy.set_yticks([])
ax[i,0].set_ylabel('y')
出于某种原因,set_yticks([])
不能代替记号。你知道吗
[In]: secaxy.get_yticks()
[Out:] array([-0.25, 0. , 0.25, 0.5 , 0.75, 1. , 1.25])
有什么方便的方法可以在绘图的右侧获得一个没有刻度的附加轴标签?你知道吗
我不会滥用辅助轴。只要把标签放在右边,把它看出来就行了。你知道吗
相关问题 更多 >
编程相关推荐