Spyder has many important and useful functionalities. Because it uses IPython console as its default, it is very convenient to use it as editor and as terminal at the same time.
Go to Tools -> Preferences (Ctrl+Alt+Shift+P
on Ubuntu). "Keyboard shortcuts" list all the useful shortcuts. On Ubuntu, followings are the most important and useful ones:
F9
: run the line
ctrl+1
, ctrl+4
: make comment or comment block. Test it by yourself to see it.
ctrl+5
: Remove the comment block
#%%
: (It's not a shortcut) Makes the "cell". Use it like this:
#%%
# Cell 1
import numpy as np
#%%
# Cell 2
print(np.ones(10))
ctrl+enter
: Run the cell, remaining at the cell.
shift+enter
: Run the cell, Proceed to the next cell.
ctrl+shift+E
: Change the focus to "editor" window
ctrl+shift+I
: Change the focus to "IPython console" window
It is better to let matplotlib
plotting window to pop-up (than showing the figure in-line). Go to the Preferences --> IPython Console --> Graphics. Set Graphics backend to "Automatic". Turn Spyder off and turn it on again. You will now see a new window pops up when you plot anything, e.g.,
import maptlotlib.pyplot as plt
plt.plot([0,1], [1,1])