Search code examples
pythonbokeh

Invert y-axis values - Bokeh


I am attempting to create a line graph with an inverted y-axis. The y-axis I was hoping to create would have a maximum value of 1 (top) and a minimum axis value of 5 (bottom).

I have not been able to find how to perform this operation in the Bokeh documentation.

Any help that anyone could provide would be greatly appreciated.


Solution

  • If you are using the default auto-ranging DataRange1d, you can set:

    p.y_range.flipped = True
    

    Or if you want to set bounds explicitly, you can when the figure is made:

    p = figure(..., y_range=(max, min)) # min/max inverted here