How to hide in IPython notebook

You can use a semi-colon ; to end the line. This suppresses the unwanted output when generating plots:

plt.plot(I,'o');

In general, using a semi-colon stops IPython from printing any output value from that line of a code block. For example, the executing the cell containing the code 1+1; would not output 2.

An alternative way would be to bind a variable to the plot:

_ = plt.plot(a)

This way, IPython only shows you the plots and the name _ is bound to the unwanted output.

Leave a Comment