Holoviews: Document xticks and yticks plot options

Created on 30 Apr 2018  路  6Comments  路  Source: holoviz/holoviews

Hi,

Is it possible to rename the axes tick labels such as in Bokeh? Ex: p.xaxis.major_label_overrides = {0: "zero", 5: "five", 10: "ten"} would replace given x axis integer tick labels with strings.

I could not find anything in the documentation. Thanks,
Derek

docs

Most helpful comment

@Forander This is something I've been meaning to bring up with bokeh, currently custom ticking does not seem to work with categorical axes (which is what bars uses).

All 6 comments

If I remember right, you can use a similar format for the xticks plot option, but it might be a list of tuples to keep the order. One example of using xticks (without custom labels) can be found on this page.

This should be documented here (but isn't). The appropriate syntax is:

hv.Curve(range(11)).options(xticks=[(0, 'zero'), (5, 'five'), (10, 'ten')])

i.e. a list of tuples.

There is at least one exception to this:
the matplotlib backend with projection=polar does not conform.

Follow up question @philippjfr : are xticks controls compatible with Bars?

hv.Bars(range(10)).options(xticks=[(0, 'zero'), (5, 'five'), (8, 'eight')])

Gives me:
"Javascript error adding output!
TypeError: a.mids is undefined
See your browser Javascript console for more details."

@Forander This is something I've been meaning to bring up with bokeh, currently custom ticking does not seem to work with categorical axes (which is what bars uses).

Was this page helpful?
0 / 5 - 0 ratings