@@ -53,7 +53,7 @@ import plotly.graph_objects as go
5353
5454fig = go.Figure()
5555
56- config = dict ( {' scrollZoom' : True })
56+ config = {' scrollZoom' : True }
5757
5858fig.add_trace(
5959 go.Scatter(
@@ -244,6 +244,8 @@ fig.add_trace(
244244 y = [1 , 3 , 1 ]))
245245
246246fig.update_layout(modebar_remove = [' zoom' , ' pan' ])
247+ 248+ fig.show()
247249```
248250
249251### Add optional shape-drawing buttons to modebar
@@ -253,16 +255,19 @@ fig.update_layout(modebar_remove=['zoom', 'pan'])
253255Some modebar buttons of Cartesian plots are optional and have to be added explicitly, using the ` modeBarButtonsToAdd ` config attribute. These buttons are used for drawing or erasing shapes. See [ the tutorial on shapes and shape drawing] ( python/shapes#drawing-shapes-on-cartesian-plots ) for more details.
254256
255257``` python
256- import plotly.graph_objects as go
257258import plotly.express as px
259+ 258260df = px.data.iris()
261+ 259262fig = px.scatter(df, x = ' petal_width' , y = ' sepal_length' , color = ' species' )
263+ 260264fig.update_layout(
261265 dragmode = ' drawopenpath' ,
262266 newshape_line_color = ' cyan' ,
263267 title_text = ' Draw a path to separate versicolor and virginica'
264268)
265- fig.show(config = {' modeBarButtonsToAdd' :[' drawline' ,
269+ 270+ fig.show(config = {' modeBarButtonsToAdd' : [' drawline' ,
266271 ' drawopenpath' ,
267272 ' drawclosedpath' ,
268273 ' drawcircle' ,
@@ -276,10 +281,12 @@ fig.show(config={'modeBarButtonsToAdd':['drawline',
276281The ` layout.modebar.add ` attribute can be used instead of the approach used above:
277282
278283``` python
279- import plotly.graph_objects as go
280284import plotly.express as px
285+ 281286df = px.data.iris()
287+ 282288fig = px.scatter(df, x = ' petal_width' , y = ' sepal_length' , color = ' species' )
289+ 283290fig.update_layout(
284291 dragmode = ' drawopenpath' ,
285292 newshape_line_color = ' cyan' ,
@@ -292,6 +299,8 @@ fig.update_layout(
292299 ' eraseshape'
293300 ]
294301)
302+ 303+ fig.show()
295304```
296305
297306### Double-Click Delay
@@ -304,12 +313,12 @@ import plotly.graph_objects as go
304313config = {' doubleClickDelay' : 1000 }
305314
306315fig = go.Figure(go.Bar(
307- y = [3 , 5 , 3 , 2 ],
308- x = [" 2019年09月02日" , " 2019年10月10日" , " 2019年11月12日" , " 2019年12月22日" ],
309- texttemplate = " %{label} " ,
310- textposition = " inside" ))
316+ y = [3 , 5 , 3 , 2 ],
317+ x = [" 2019年09月02日" , " 2019年10月10日" , " 2019年11月12日" , " 2019年12月22日" ],
318+ texttemplate = " %{label} " ,
319+ textposition = " inside" ))
311320
312- fig.update_layout(xaxis = {' type' : ' date' })
321+ fig.update_layout(xaxis = {' type' : ' date' })
313322
314323fig.show(config = config)
315324```
@@ -320,4 +329,4 @@ The same configuration dictionary that you pass to the `config` parameter of the
320329
321330#### Reference
322331
323- See config options at https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L6
332+ See config options at https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js
0 commit comments