Skip to content

Commit

Permalink
Merge 6de3984 into cf91012
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 committed Oct 8, 2018
2 parents cf91012 + 6de3984 commit b35cab1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
27 changes: 26 additions & 1 deletion holoviews/plotting/bokeh/element.py
Expand Up @@ -12,11 +12,13 @@
from bokeh.models.tickers import Ticker, BasicTicker, FixedTicker, LogTicker
from bokeh.models.widgets import Panel, Tabs
from bokeh.models.mappers import LinearColorMapper
from bokeh.models import CategoricalAxis
try:
from bokeh.models import ColorBar
from bokeh.models.mappers import LogColorMapper, CategoricalColorMapper
except ImportError:
LogColorMapper, ColorBar = None, None
from holoviews.plotting.bokeh.util import theme_attr_json
from bokeh.plotting.helpers import _known_tools as known_tools

from ...core import DynamicMap, CompositeOverlay, Element, Dimension
Expand Down Expand Up @@ -399,7 +401,9 @@ def _axis_properties(self, axis, key, plot, dimension=None,
Returns a dictionary of axis properties depending
on the specified axis.
"""
axis_props = {}
# need to copy dictionary by calling dict() on it
axis_props = dict(theme_attr_json(self.renderer.theme, 'Axis'))

if ((axis == 'x' and self.xaxis in ['bottom-bare', 'top-bare']) or
(axis == 'y' and self.yaxis in ['left-bare', 'right-bare'])):
axis_props['axis_label_text_font_size'] = value('0pt')
Expand Down Expand Up @@ -460,6 +464,27 @@ def _axis_properties(self, axis, key, plot, dimension=None,
if jsfunc:
formatter = FuncTickFormatter(code=jsfunc)
axis_props['formatter'] = formatter

if axis == 'x':
axis_obj = plot.xaxis[0]
elif axis == 'y':
axis_obj = plot.yaxis[0]

if isinstance(axis_obj, CategoricalAxis):
for key in list(axis_props):
if key.startswith('major_label'):
# set the group labels equal to major (actually minor)
new_key = key.replace('major_label', 'group')
axis_props[new_key] = axis_props[key]

# major ticks are actually minor ticks in a categorical
# so if user inputs minor ticks sizes, then use that;
# else keep major (group) == minor (subgroup)
msize = self._fontsize('minor_{0}ticks'.format(axis),
common=False).get('fontsize')
if msize is not None:
axis_props['major_label_text_font_size'] = msize

return axis_props


Expand Down
10 changes: 7 additions & 3 deletions holoviews/plotting/plot.py
Expand Up @@ -192,9 +192,11 @@ class DimensionedPlot(Plot):
together using the 'labels' key.""")

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

show_title = param.Boolean(default=True, doc="""
Whether to display the plot title.""")
Expand Down Expand Up @@ -337,6 +339,8 @@ def _fontsize(self, key, label='fontsize', common=True):
return {label:self.fontsize['labels']}
elif key in ['xticks', 'yticks', 'zticks'] and 'ticks' in self.fontsize:
return {label:self.fontsize['ticks']}
elif key in ['minor_xticks', 'minor_yticks'] and 'minor_ticks' in self.fontsize:
return {label:self.fontsize['minor_ticks']}
else:
return {}

Expand Down

0 comments on commit b35cab1

Please sign in to comment.