@@ -20,7 +20,7 @@ jupyter:
20
20
name : python
21
21
nbconvert_exporter : python
22
22
pygments_lexer : ipython3
23
- version : 3.6.7
23
+ version : 3.7.3
24
24
plotly :
25
25
description : How to make Facet and Trellis Plots in Python with Plotly.
26
26
display_as : statistical
@@ -58,6 +58,18 @@ fig = px.bar(tips, x="size", y="total_bill", color="sex", facet_row="smoker")
58
58
fig.show()
59
59
```
60
60
61
+ ### Wrapping Column Facets
62
+
63
+ When the facet dimension has a large number of unique values, it is possible to wrap columns using the ` facet_col_wrap ` argument.
64
+
65
+ ``` python
66
+ import plotly.express as px
67
+ df = px.data.gapminder()
68
+ fig = px.scatter(df, x = ' gdpPercap' , y = ' lifeExp' , color = ' continent' , size = ' pop' ,
69
+ facet_col = ' year' , facet_col_wrap = 4 )
70
+ fig.show()
71
+ ```
72
+
61
73
### Histogram Facet Grids
62
74
63
75
``` python
@@ -67,3 +79,20 @@ fig = px.histogram(tips, x="total_bill", y="tip", color="sex", facet_row="time",
67
79
category_orders = {" day" : [" Thur" , " Fri" , " Sat" , " Sun" ], " time" : [" Lunch" , " Dinner" ]})
68
80
fig.show()
69
81
```
82
+
83
+ ### Facets with independent axes
84
+
85
+ By default, facet axes are linked together: zooming inside one of the facets will also zoom in the other facets. You can disable this behaviour as follows.
86
+
87
+ ``` python
88
+ import plotly.express as px
89
+ df = px.data.tips()
90
+ fig = px.scatter(df, x = " total_bill" , y = " tip" , color = ' sex' ,
91
+ facet_row = " day" , facet_col = ' time' )
92
+ # No match between subplot axes
93
+ fig.update_xaxes(matches = None )
94
+ fig.update_yaxes(matches = None )
95
+ # Show ticks for each axis since they are now independent
96
+ fig.update_xaxes(showticklabels = True )
97
+ fig.show()
98
+ ```
0 commit comments