How to shrink the size of cell output in the google colaboratory?

Viewed 1832

enter image description here

I would like to decrease the size of the cell output in google Colab. I am doing reinforcement learning tasks with it and printing out the progress of the training. It seems quite annoying with the fact that even though I could scroll up and down within cell, there is no option that I could use to control the size of the cell output.

Is there any way to decrease the size of the cell output?

2 Answers

You can change the output size with this command.

from google.colab.output import eval_js
eval_js('google.colab.output.setIframeHeight("500")')

for those who have a similar issue with me, just like what this guy is saying, you can use the below code in order to shrink the size of the cell output. I thought once you put that code in the very beginning, it initializes for whole cells, but it isn't. You have to put above code "in the cell that you want to reduce the size."

from IPython.display import Javascript
display(Javascript('''google.colab.output.setIframeHeight(0, true, {maxHeight: 500})'''))
for i in range(200):
print(i)
Related