File tree 3 files changed +42
-3
lines changed
3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ Bug Fixes
44
44
:class: `~plotnine.stats.stat_bin_2d ` to properly handle the
45
45
``breaks `` parameter when used with a transforming scale.
46
46
47
+ - Fixed issue with x and y scales where the ``name `` of the scale was
48
+ ignored when determining the axis titles. Now, the ``name `` parameter
49
+ is specified, it is used as the title. (:issue: `105 `)
50
+
47
51
v0.3.0
48
52
------
49
53
*(2017-11-08) *
Original file line number Diff line number Diff line change @@ -202,3 +202,37 @@ def check_layout(self):
202
202
raise PlotnineError (
203
203
"Facet layout has bad format. It must contain "
204
204
"the columns '{}'" .format (required ))
205
+
206
+ def xlabel (self , labels ):
207
+ """
208
+ Determine x-axis label
209
+
210
+ Parameters
211
+ ----------
212
+ labels : dict
213
+ Labels as specified by the user through the ``labs`` or
214
+ ``xlab`` calls.
215
+
216
+ Returns
217
+ -------
218
+ out : str
219
+ x-axis label
220
+ """
221
+ return self .panel_scales_x [0 ].name or labels .get ('x' , '' )
222
+
223
+ def ylabel (self , labels ):
224
+ """
225
+ Determine x-axis label
226
+
227
+ Parameters
228
+ ----------
229
+ labels : dict
230
+ Labels as specified by the user through the ``labs`` or
231
+ ``ylab`` calls.
232
+
233
+ Returns
234
+ -------
235
+ out : str
236
+ y-axis label
237
+ """
238
+ return self .panel_scales_y [0 ].name or labels .get ('y' , '' )
Original file line number Diff line number Diff line change @@ -498,9 +498,10 @@ def _draw_labels(self):
498
498
499
499
# Get the axis labels (default or specified by user)
500
500
# and let the coordinate modify them e.g. flip
501
- labels = self .coordinates .labels (
502
- {'x' : self .labels .get ('x' , '' ),
503
- 'y' : self .labels .get ('y' , '' )})
501
+ labels = self .coordinates .labels ({
502
+ 'x' : self .layout .xlabel (self .labels ),
503
+ 'y' : self .layout .ylabel (self .labels )
504
+ })
504
505
505
506
# The first axes object is on left, and the last axes object
506
507
# is at the bottom. We change the transform so that the relevant
You can’t perform that action at this time.
0 commit comments