Skip to content

Commit

Permalink
Add support to adjust fontsize for zlabels/zticks (#2967)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored and philippjfr committed Oct 25, 2018
1 parent c55b044 commit 0ffa0e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion holoviews/plotting/mpl/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,14 @@ def _finalize_ticks(self, axis, dimensions, xticks, yticks, zticks):
self._set_axis_ticks(axis.zaxis, zticks, log=self.logz,
rotation=self.zrotation)

for ax, ax_obj in zip('xy', [axis.xaxis, axis.yaxis]):
axes_str = 'xy'
axes_list = [axis.xaxis, axis.yaxis]

if hasattr(axis, 'zaxis'):
axes_str += 'z'
axes_list.append(axis.zaxis)

for ax, ax_obj in zip(axes_str, axes_list):
tick_fontsize = self._fontsize('%sticks' % ax,'labelsize',common=False)
if tick_fontsize: ax_obj.set_tick_params(**tick_fontsize)

Expand Down
12 changes: 6 additions & 6 deletions holoviews/plotting/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ class DimensionedPlot(Plot):
unmentioned keys reverts to the default sizes, e.g:
{'ticks':20, 'title':15,
'ylabel':5, 'xlabel':5,
'ylabel':5, 'xlabel':5, 'zlabel':5,
'legend':8, 'legend_title':13}
You can set the fontsize of both 'ylabel' and 'xlabel' together
You can set the fontsize of 'zlabel', 'ylabel' and 'xlabel' together
using the 'labels' key.""")

#Allowed fontsize keys
_fontsize_keys = ['xlabel','ylabel', 'labels', 'ticks',
_fontsize_keys = ['xlabel','ylabel', 'zlabel', 'labels', 'ticks',
'title', 'legend', 'legend_title', 'xticks',
'yticks']
'yticks', 'zticks']

show_title = param.Boolean(default=True, doc="""
Whether to display the plot title.""")
Expand Down Expand Up @@ -330,9 +330,9 @@ def _fontsize(self, key, label='fontsize', common=True):

if key in self.fontsize:
return {label:self.fontsize[key]}
elif key in ['ylabel', 'xlabel'] and 'labels' in self.fontsize:
elif key in ['zlabel', 'ylabel', 'xlabel'] and 'labels' in self.fontsize:
return {label:self.fontsize['labels']}
elif key in ['xticks', 'yticks'] and 'ticks' in self.fontsize:
elif key in ['xticks', 'yticks', 'zticks'] and 'ticks' in self.fontsize:
return {label:self.fontsize['ticks']}
else:
return {}
Expand Down

0 comments on commit 0ffa0e9

Please sign in to comment.