Search code examples
pythonmatplotlibjupyter-notebookseaborn

Output from matplotlib in Juptyter Notebook


I have functioning code in Juptyer notebook to simulate a game of snakes and ladders (chutes and ladders in some places). The code produces additional out that I have no idea where it is coming from our what parts of it mean. Ideally I'd like to (a) know why its there and (b) supress it.

Next to Out 1: Juptyer is displaying Text(0.5,1.0, 'Simulated Duration of Snakes & Ladders Games Board')

The 'Simulated Duration of Snakes & Ladders Games Board' is the title I've just set.

What does the 0.5,1.0 refer and can I supress the output -- so that just the image is displayed.

I am assuming this is a parameter somewhere I pass to matplotlib or seaborn?

Sorry for such a low level Q.

enter image description here


Solution

  • Just add a semicolon ; at the end of the last line of your Jupyter cell to suppress the output. So use

    plt.title("Simulated Duration of Snakes & Ladders Games Board"); # <--- Semicolon 
    

    The printed line just shows the text (figure title) that you passed to the plt.title and the numbers 0.5, 1.0 tell the location of the title, which is 0.5 (centered) on the x-axis and 1 on the y-axis in relative (or fractional) coordinates.