Search code examples
pythonpython-3.xmatplotlibdata-visualizationbokeh

Python: Bokeh Plotting Setting the Vertical Axis (Y-axis) Using Function as Scale


I wanted to create a weibull probability plot using Bokeh. Based on the reference (linked below),

https://www.itl.nist.gov/div898/handbook/eda/section3/weibplot.htm

The y-axis of a weibull probability plot has an axes with scale: ln(-ln(1-p)). Let's say that I have defined a function (with it's inverse function),

import numpy as np

def forward(X):
    return np.log(-np.log(1 - X))

def inverse(Y):
    return 1 - np.exp(-np.exp(Y))

Using matplotlib.pyplot (from https://matplotlib.org/stable/gallery/scales/scales.html), I could use those function for setting the y-axis' scale on pyplot by,

import matplotlib.pyplot as plt

fig, ax = .........
ax.set_yscale('function', functions=(forward, inverse))

How can I achieve that (setting y-axis scale using function) on Bokeh?


Solution

  • Scale application actually happens in JavaScript, in the browser, not in any Python code. So no Python functions are relevant to the question with respect to Bokeh. As of version 2.3.1, only categorical , linear, and (standard) log scales are supported in the BokehJS client library.