@@ -10,27 +10,33 @@ Create a series of plots as subplots, all providing unique perspectives on the d
1010
1111``` python order=tipping_plots,tips
1212import deephaven.plot.express as dx
13- tips = dx.data.tips() # import a ticking version of the Tips dataset
13+
14+ tips = dx.data.tips() # import a ticking version of the Tips dataset
1415
1516# create 4 plots from within make_subplots
1617tipping_plots = dx.make_subplots(
17- dx.scatter(tips, x = " TotalBill " , y = " Tip " , by = " Sex " ,
18- title = " Tip amount by total bill" ),
19- dx.violin(tips, y = " TotalBill " , by = " Day " ,
20- title = " Total bill distribution by day" ),
18+ dx.scatter(
19+ tips, x = " TotalBill " , y = " Tip " , by = " Sex " , title = " Tip amount by total bill"
20+ ) ,
21+ dx.violin(tips, y = " TotalBill " , by = " Day " , title = " Total bill distribution by day" ),
2122 dx.pie(
22- tips
23- .count_by(" Count" , by = [" Sex" , " Smoker" ])
23+ tips.count_by(" Count" , by = [" Sex" , " Smoker" ])
2424 .update_view(" SmokerStatus = Smoker == `No` ? `non-smoker` : `smoker`" )
2525 .update_view(" SmokerLabel = Sex + ` ` + SmokerStatus" ),
26- names = " SmokerLabel" , values = " Count" ,
27- title = " Total bill by sex and smoking status" ),
28- dx.bar(tips
29- .view([" TotalBill" , " Tip" , " Day" ])
30- .avg_by(" Day" ),
31- x = " Day" , y = [" TotalBill" , " Tip" ],
32- title = " Average tip as a fraction of total bill" ),
33- rows = 2 , cols = 2 , shared_xaxes = False , shared_yaxes = False
26+ names = " SmokerLabel" ,
27+ values = " Count" ,
28+ title = " Total bill by sex and smoking status" ,
29+ ),
30+ dx.bar(
31+ tips.view([" TotalBill" , " Tip" , " Day" ]).avg_by(" Day" ),
32+ x = " Day" ,
33+ y = [" TotalBill" , " Tip" ],
34+ title = " Average tip as a fraction of total bill" ,
35+ ),
36+ rows = 2 ,
37+ cols = 2 ,
38+ shared_xaxes = False ,
39+ shared_yaxes = False ,
3440)
3541```
3642
@@ -40,6 +46,7 @@ You can add titles to individual subplots using the `subplot_titles` parameter.
4046
4147``` python order=tipping_plots,lunch_tips,dinner_tips
4248import deephaven.plot.express as dx
49+
4350tips = dx.data.tips()
4451
4552lunch_tips = tips.where(" Time = `Lunch`" )
@@ -50,7 +57,7 @@ tipping_plots = dx.make_subplots(
5057 dx.scatter(lunch_tips, x = " TotalBill" , y = " Tip" ),
5158 dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" ),
5259 rows = 2 ,
53- subplot_titles = [" Lunch Tips" , " Dinner Tips" ]
60+ subplot_titles = [" Lunch Tips" , " Dinner Tips" ],
5461)
5562```
5663
@@ -60,6 +67,7 @@ You can automatically use the titles from the original figures as subplot titles
6067
6168``` python order=tipping_plots,lunch_tips,dinner_tips
6269import deephaven.plot.express as dx
70+
6371tips = dx.data.tips()
6472
6573lunch_tips = tips.where(" Time = `Lunch`" )
@@ -71,9 +79,7 @@ dinner_chart = dx.scatter(dinner_tips, x="TotalBill", y="Tip", title="Dinner Tip
7179
7280# Use existing titles as subplot titles
7381tipping_plots = dx.make_subplots(
74- lunch_chart, dinner_chart,
75- rows = 2 ,
76- use_existing_titles = True
82+ lunch_chart, dinner_chart, rows = 2 , use_existing_titles = True
7783)
7884```
7985
@@ -83,14 +89,15 @@ You can add an overall title to the combined subplot figure using the `title` pa
8389
8490``` python order=tipping_plots,tips
8591import deephaven.plot.express as dx
92+
8693tips = dx.data.tips()
8794
8895tipping_plots = dx.make_subplots(
8996 dx.scatter(tips, x = " TotalBill" , y = " Tip" , by = " Day" ),
9097 dx.histogram(tips, x = " TotalBill" ),
9198 rows = 2 ,
9299 subplot_titles = [" Daily Patterns" , " Distribution" ],
93- title = " Tipping Analysis"
100+ title = " Tipping Analysis" ,
94101)
95102```
96103
@@ -105,7 +112,8 @@ When one axis is adjusted, all axes are adjusted to match.
105112
106113``` python order=tipping_plots,lunch_tips,dinner_tips
107114import deephaven.plot.express as dx
108- tips = dx.data.tips() # import a ticking version of the Tips dataset
115+
116+ tips = dx.data.tips() # import a ticking version of the Tips dataset
109117
110118# filter the tips dataset for separate lunch and dinner charts
111119lunch_tips = tips.where(" Time = `Lunch`" )
@@ -115,7 +123,9 @@ dinner_tips = tips.where("Time = `Dinner`")
115123tipping_plots = dx.make_subplots(
116124 dx.scatter(lunch_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Lunch Tips" }),
117125 dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
118- rows = 2 , shared_yaxes = " all" , shared_xaxes = " all"
126+ rows = 2 ,
127+ shared_yaxes = " all" ,
128+ shared_xaxes = " all" ,
119129)
120130```
121131
@@ -126,7 +136,8 @@ When one y-axis is adjusted, all axes along the same row are adjusted to match.
126136
127137``` python order=tipping_plots,lunch_tips,dinner_tips
128138import deephaven.plot.express as dx
129- tips = dx.data.tips() # import a ticking version of the Tips dataset
139+
140+ tips = dx.data.tips() # import a ticking version of the Tips dataset
130141
131142# filter the tips dataset for separate lunch and dinner charts
132143lunch_tips = tips.where(" Time = `Lunch`" )
@@ -135,16 +146,18 @@ dinner_tips = tips.where("Time = `Dinner`")
135146# create chart that shares y axes along the row
136147tipping_plots = dx.make_subplots(
137148 dx.scatter(lunch_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Lunch Tips" }),
138- dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
139- cols = 2 , shared_yaxes = True
149+ dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
150+ cols = 2 ,
151+ shared_yaxes = True ,
140152)
141153```
142154
143155To share the y axes along the same column, set ` shared_yaxes ` to ` "columns" ` .
144156
145157``` python order=tipping_plots,lunch_tips,dinner_tips
146158import deephaven.plot.express as dx
147- tips = dx.data.tips() # import a ticking version of the Tips dataset
159+
160+ tips = dx.data.tips() # import a ticking version of the Tips dataset
148161
149162# filter the tips dataset for separate lunch and dinner charts
150163lunch_tips = tips.where(" Time = `Lunch`" )
@@ -153,8 +166,9 @@ dinner_tips = tips.where("Time = `Dinner`")
153166# create chart that shares y axes along the column
154167tipping_plots = dx.make_subplots(
155168 dx.scatter(lunch_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Lunch Tips" }),
156- dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
157- rows = 2 , shared_yaxes = " columns"
169+ dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
170+ rows = 2 ,
171+ shared_yaxes = " columns" ,
158172)
159173```
160174
@@ -165,7 +179,8 @@ When one x-axis is adjusted, all axes along the same column are adjusted to matc
165179
166180``` python order=tipping_plots,lunch_tips,dinner_tips
167181import deephaven.plot.express as dx
168- tips = dx.data.tips() # import a ticking version of the Tips dataset
182+
183+ tips = dx.data.tips() # import a ticking version of the Tips dataset
169184
170185# filter the tips dataset for separate lunch and dinner charts
171186lunch_tips = tips.where(" Time = `Lunch`" )
@@ -174,16 +189,18 @@ dinner_tips = tips.where("Time = `Dinner`")
174189# create chart that shares x axes along the column
175190tipping_plots = dx.make_subplots(
176191 dx.scatter(lunch_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Lunch Tips" }),
177- dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
178- rows = 2 , shared_xaxes = True
192+ dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
193+ rows = 2 ,
194+ shared_xaxes = True ,
179195)
180196```
181197
182198To share the x axes along the same column, set ` shared_yaxes ` to ` "columns" ` .
183199
184200``` python order=tipping_plots,lunch_tips,dinner_tips
185201import deephaven.plot.express as dx
186- tips = dx.data.tips() # import a ticking version of the Tips dataset
202+
203+ tips = dx.data.tips() # import a ticking version of the Tips dataset
187204
188205# filter the tips dataset for separate lunch and dinner charts
189206lunch_tips = tips.where(" Time = `Lunch`" )
@@ -192,8 +209,9 @@ dinner_tips = tips.where("Time = `Dinner`")
192209# create chart that shares x axes along the row
193210tipping_plots = dx.make_subplots(
194211 dx.scatter(lunch_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Lunch Tips" }),
195- dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
196- cols = 2 , shared_xaxes = " rows"
212+ dx.scatter(dinner_tips, x = " TotalBill" , y = " Tip" , labels = {" Tip" : " Dinner Tips" }),
213+ cols = 2 ,
214+ shared_xaxes = " rows" ,
197215)
198216```
199217
0 commit comments