Resizing plots
Last updated
Last updated
Depending on the programming language (R or Python) and visualization package you use, plots you create inside DataLab will appear with different dimensions. This article describes the default behavior for the most common visualization packages and how you can customize it to suit your needs.
A workbook with the code samples in this article is publicly available here.
By default, figures will be 6.4 x 4.8 inches. If the output area of a code cell is smaller, the image will be scaled to fit inside it.
You can change the size of a specific plot by including the following code before you create the plot:
If you want to set a different deafult figure size for all plots you're creating in your notebook, you can include the following snippet at the top of your notebook:
For plots generated in Plotly, the width is adjusted to fit the with of the output area of the code section (which adjusts with the width of your viewport). The default height is 450 pixels.
You can override these defaults using the width
and height
arguments:
A workbook with the code samples in this article is publicy available here.
By default plots will be 7 x 7 inches, with a resolution of 120 dots per inch:
You can control this by setting repr.plot
options. Note that, once called, these options will be used for all plots you generate from that point on.
For plots generated in Plotly, the width is adjusted to fit the with of the output area of the code section (which adjusts with the width of your viewport). The default height is 450 pixels.
You can override these defaults using the width
and height
arguments: