@@ -134,8 +134,9 @@ samples = [
134134# And finish by styling it up to your liking!
135135fig = ridgeplot(
136136 samples = samples,
137- labels = [[" Min Temperature [F] " , " Max Temperature [F] " ]] * len (months),
137+ labels = [[" Min Temperatures " , " Max Temperatures " ]] * len (months),
138138 row_labels = months,
139+ legendgroup = True ,
139140 colorscale = " Inferno" ,
140141 bandwidth = 4 ,
141142 kde_points = np.linspace(- 40 , 110 , 400 ),
@@ -152,7 +153,12 @@ fig.update_layout(
152153 xaxis_gridwidth = 2 ,
153154 yaxis_title = " Month" ,
154155 xaxis_title = " Temperature [F]" ,
155- showlegend = False ,
156+ legend = dict (
157+ yanchor = " top" ,
158+ y = 0.99 ,
159+ xanchor = " right" ,
160+ x = 0.99 ,
161+ ),
156162)
157163fig.show()
158164```
@@ -229,14 +235,14 @@ Finally, we can pass the {py:paramref}`~ridgeplot.ridgeplot.samples` list to the
229235``` python
230236fig = ridgeplot(
231237 samples = samples,
232- labels = [[" Min Temperature [F] " , " Max Temperature [F] " ]] * len (months),
238+ labels = [[" Min Temperatures " , " Max Temperatures " ]] * len (months),
233239 row_labels = months,
240+ legendgroup = True ,
234241 colorscale = " Inferno" ,
235242 bandwidth = 4 ,
236243 kde_points = np.linspace(- 40 , 110 , 400 ),
237244 spacing = 0.3 ,
238245)
239-
240246fig.update_layout(
241247 title = " Minimum and maximum daily temperatures in Lincoln, NE (2016)" ,
242248 height = 600 ,
@@ -248,7 +254,12 @@ fig.update_layout(
248254 xaxis_gridwidth = 2 ,
249255 yaxis_title = " Month" ,
250256 xaxis_title = " Temperature [F]" ,
251- showlegend = False ,
257+ legend = dict (
258+ yanchor = " top" ,
259+ y = 0.99 ,
260+ xanchor = " right" ,
261+ x = 0.99 ,
262+ ),
252263)
253264fig.show()
254265```
@@ -277,8 +288,8 @@ fig = ridgeplot(
277288 # addition of `color_discrete_map`
278289 # ...
279290 color_discrete_map = {
280- " Min Temperature [F] " : " deepskyblue" ,
281- " Max Temperature [F] " : " orangered" ,
291+ " Min Temperatures " : " deepskyblue" ,
292+ " Max Temperatures " : " orangered" ,
282293 }
283294 # ...
284295)
0 commit comments