How do I change the figure size for a seaborn plot?

How do I change the size of my image so it's suitable for printing?

For example, I'd like to use to A4 paper, whose dimensions are 11.7 inches by 8.27 inches in landscape orientation.

You need to create the matplotlib Figure and Axes objects ahead of time, specifying how big the figure is:

    from matplotlib import pyplot
    import seaborn

    import mylib

    a4_dims = (11.7, 8.27)
    df = mylib.load_data()
    fig, ax = pyplot.subplots(figsize=a4_dims)
    seaborn.violinplot(ax=ax, data=df, **violin_options)


Back to homepage or read more recommendations: