Navigation Keyboard Shortcuts

导航快捷键,发现很挺有用的,对于多角度全方位观察图形,很方便.比如想缩放图形的一部分区域,只需要按一下o键,然后按住鼠标左键拖动该区域即可,按r则又回到初始绘图状态
Command Keyboard Shortcut(s)

h or r or home回到初始的绘图状态
 c or left arrow or backspace回到上一次的视图
v or right arrow进入到下一次的视图
p移动图像或缩放图像,(按p键以后,如果再按鼠标左键可移动坐标轴,如果按的是鼠标右键+拖动则是缩放图像)
 o缩放鼠标拖到的区域
s打开保存figure对话框
f全屏显示(这个键在我的电脑上发现没有作用,是不是bug?)
hold x按住x不放,只可以移动x轴或值缩放x轴
hold y按住y不放,可以只移动y轴或值缩放y轴

hold CONTROL
按住ctrl键会以最佳的显示分辨率显示图形
g显示或关闭网格
L or k:(大写的L或小写的k)使x轴对数坐标或线形坐标
l(小写的L)使y轴对数坐标或线形坐标

以上定义的快捷键是可以在 matplotlibrc配置文件中改写的(#keymap.*).

 

 

使用python中的matplotlib 画图,show后关闭窗口,继续运行命令

 

在用python中的matplotlib 画图时,show()函数总是要放在最后,且它阻止命令继续往下运行,直到1.0.1版本才支持多个show()的使用。
想在显示图像后继续运行相关的处理命令,或者显示一副图像后关闭它,再显示第二幅图像。如下办法:

首先搜索到:
plt.close() will close current instance.
plt.close(2) will close figure 2
plt.close(plot1) will close figure with instance plot1
plt.close('all') will close all fiures
Found here.
Remember that plt.show() is a blocking function, so in the example code you used above,plt.close() isn't being executed until the window is closed, which makes it redundant.
You can use plt.ion() at the beginning of your code to make it non-blocking, although this has other implication

 

更多推荐