You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Use the keyword arguments`facet_row` (resp.`facet_col`) to create facetted subplots, where different rows (resp. columns) correspond to different values of the dataframe column specified in`facet_row`.
marker_color=colors# marker color can be a single color value or an iterable
196
210
)
197
211
198
212
fig= go.Figure(data=[trace0])
199
213
fig.update(layout_title_text='Least Used Feature')
200
-
fig
201
214
```
202
215
203
216
###Customizing Individual Bar Widths
@@ -208,38 +221,39 @@ import plotly.graph_objs as go
208
221
trace0= go.Bar(
209
222
x=[1,2,3,5.5,10],
210
223
y=[10,8,6,4,2],
211
-
width=[0.8,0.8,0.8,3.5,4]
224
+
width=[0.8,0.8,0.8,3.5,4]# customize width here
212
225
)
213
226
214
227
fig= go.Figure(data=[trace0])
215
-
fig
228
+
fig.show()
216
229
```
217
230
218
231
###Customizing Individual Bar Base
219
232
220
-
*I find this example not very good, because I think I would instead plot negative values for the expenses instead of changing the base. Can we come up with a better idea?*
221
233
222
234
```python
223
235
import plotly.graph_objsas go
224
236
225
237
years= ['2016','2017','2018']
226
238
227
239
trace0= go.Bar(x=years,y=[500,600,700],
228
-
base=[-500,-600,-700],
240
+
base=[-500,-600,-700],
229
241
marker_color='red',
230
-
name='expenses')
242
+
name='expenses')
231
243
trace1= go.Bar(x=years,y=[300,400,700],
232
244
base=0,
233
245
marker_color='blue',
234
246
name='revenue'
235
247
)
236
248
237
249
fig= go.Figure(data=[trace0, trace1])
238
-
fig
250
+
fig.show()
239
251
```
240
252
241
253
###Colored and Styled Bar Chart
242
254
255
+
In this example several parameters of the layout as customized, hence it is convenient to use directly the`go.Layout(...)` constructor instead of calling`fig.update`.
256
+
243
257
```python
244
258
import plotly.graph_objsas go
245
259
@@ -285,12 +299,12 @@ layout = go.Layout(
285
299
bordercolor='rgba(255, 255, 255, 0)'
286
300
),
287
301
barmode='group',
288
-
bargap=0.15,
289
-
bargroupgap=0.1
302
+
bargap=0.15,# gap between bars of adjacent location coordinates.
303
+
bargroupgap=0.1# gap between bars of the same location coordinate.
290
304
)
291
305
292
306
fig= go.Figure(data=data,layout=layout)
293
-
fig
307
+
fig.show()
294
308
```
295
309
296
310
###Waterfall Bar Chart
@@ -346,11 +360,14 @@ for i in range(0, 7):
346
360
347
361
fig= go.Figure(data=data,layout=layout)
348
362
fig.update_traces(marker_line_width=2)
349
-
fig
363
+
fig.show()
350
364
```
351
365
352
366
###Bar Chart with Relative Barmode
353
367
368
+
With "relative" barmode, the bars are stacked on top of one another, with negative values
369
+
below the axis, positive values above.
370
+
354
371
```python
355
372
x= [1,2,3,4]
356
373
@@ -363,7 +380,6 @@ data = [trace0, trace1, trace2, trace3];