Skip to content

Commit bd896ee

Browse files
committed
Update setting-graph-size.md
1 parent 94196a6 commit bd896ee

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

doc/python/setting-graph-size.md

+37-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.8
23+
version: 3.8.0
2424
plotly:
2525
description: How to manipulate the graph size, margins and background color.
2626
display_as: file_settings
@@ -163,6 +163,42 @@ fig.update_layout(
163163

164164
fig.update_yaxes(automargin='left+top')
165165

166+
fig.show()
167+
```
168+
169+
### Setting a Minimum Plot Size with Automargins
170+
171+
*New in 5.11*
172+
173+
To set a minimum width and height for a plot to be after automargin is applied, use `minreducedwidth` and `minreducedheight`. Here we set both to `250`.
174+
175+
```python
176+
import plotly.graph_objects as go
177+
178+
179+
fig = go.Figure()
180+
181+
fig.add_trace(go.Bar(
182+
x=["Apples", "Oranges", "Watermelon", "Pears"],
183+
y=[3, 2, 1, 4]
184+
))
185+
186+
fig.update_layout(
187+
autosize=False,
188+
minreducedwidth=250,
189+
minreducedheight=250,
190+
width=450,
191+
height=450,
192+
yaxis=dict(
193+
title_text="Y-axis Title",
194+
ticktext=["Label", "Very long label", "Other label", "Very very long label"],
195+
tickvals=[1, 2, 3, 4],
196+
tickmode="array",
197+
titlefont=dict(size=30),
198+
)
199+
)
200+
201+
166202
fig.show()
167203
```
168204

0 commit comments

Comments
 (0)