Creo una figura in una funzione, ad es.Come posso ottenere `set_xlim` o` set_ylim` in Bokeh?
import numpy
from bokeh.plotting import figure, show, output_notebook
output_notebook()
def make_fig():
rows = cols = 16
img = numpy.ones((rows, cols), dtype=numpy.uint32)
view = img.view(dtype=numpy.uint8).reshape((rows, cols, 4))
view[:, :, 0] = numpy.arange(256)
view[:, :, 1] = 265 - numpy.arange(256)
fig = figure(x_range=[0, c], y_range=[0, rows])
fig.image_rgba(image=[img], x=[0], y=[0], dw=[cols], dh=[rows])
return fig
Più tardi voglio per ingrandire la figura:
fig = make_fig()
# <- zoom in on plot, like `set_xlim` from matplotlib
show(fig)
Come posso fare zoom programmatico in bokeh?
Come implementarlo su y_axis_type = 'log'? Non funziona con quella parte inferiore e superiore. – asofyan
Non funziona per me. Dovevo fare 'fig.x_range = Range1d (x_min, x_max)' –
'set' era davvero un dettaglio di implementazione, e da allora è stato rimosso. Ho aggiornato la risposta. – bigreddot