我试图将已经创建的任意数量的matplotlib数字保存到1个文件中(PDF?).有没有办法用一个命令做到这一点?
如何删除颜色条上的边框(或使它们更薄)?
我几乎尝试了以下各种组合:
cb = plt.colorbar(im3,drawedges=False) #or True with next two lines
#cb.outline.set_linewidth(0)
#cb.dividers.set_linewidth(0)
cb.solids.set_rasterized(True)
cb.solids.set_edgecolor("face")
#Im saving as pdf
plt.savefig("thing.pdf",dpi=1000, bbox_inches='tight')
Run Code Online (Sandbox Code Playgroud)
当使用matplotlib图查看时,其中一些有帮助,但保存的pdf更糟糕.

我想使用 python 实现 Fortran 中 ISHFTPC 函数的等效功能。做这个的最好方式是什么?
例如,
x = '0100110'
s = int(x, 2)
s_shifted = ISHFTC(s,1,7) #shifts to left by 1
#binary representation of s_shifted should be 1001100
Run Code Online (Sandbox Code Playgroud)
我的尝试基于c 中的循环移位
def ISHFTC(n, d,N):
return (n << d)|(n >> (N - d))
Run Code Online (Sandbox Code Playgroud)
但是,这并没有达到我想要的效果。例子,
ISHFTC(57,1,6) #57 is '111001'
Run Code Online (Sandbox Code Playgroud)
给出 115,即“1110011”,而我想要“110011”