Search code examples
python-3.xbokeh

Python Bokeh set axis minimum only, without setting the whole range


It's nice that I don't have to specify the axis ranges when I want to do a quick and easy plot, and that Bokeh does it automatically (like every other plotting library), but is there to set an axis minimum only, while letting Bokeh automatically set the maximum? I know I can set the full range by setting Figure.y_range or whatever, but I can't seem to set just the y-minimum, for example.


Solution

  • You can set the start value of the y_range after defining the figure.

    from bokeh.plotting import figure, show, output_notebook
    output_notebook()
    
    p = figure(width=300, height=300)
    p.line([1,2,3,4], [1,2,3,4])
    p.y_range.start=2
    show(p)
    
    default y_range.start=2
    enter image description here y_range.start == 2