BokehJS: Is it possible to dynamically change the x and y ranges of the graph after its been created?

I have a graph where the x and y ranges are set when its created:
Based on the min and max of the data

//Make the plot
	var plot = Bokeh.Plotting.figure({
		title: "test",
		tools: "pan,wheel_zoom,box_zoom,reset",
		toolbar_location: "right",
		toolbar_sticky: false,
		x_range: [min_x, max_x],
		x_axis_type: "log",
		x_axis_label: "Offset Frequency (Hz)",
		y_range: [closestMin, closestMax],
		y_axis_type: "linear",
		y_axis_label: "Phase Noise (dBc/Hz)",
		extra_y_ranges: { "y2_range": y2_range },
		extra_y_scales: { "y2_range": new Bokeh.LogScale() },
		resizable: true,
		width_policy: "max", //makes graph grow to fit the div exactly

I then have a function where the user can change the data of one of the data sources.
When the data source changes are emitted, the line changes as it should but the line may go somewhat out of view.

This is what I tried:
Inside change data source data function:

console.log("y_range: " + BOKEH_PLOT_1.y_range);
BOKEH_PLOT_1.y_range = new Bokeh.Range1d({ start: -200, end: -10 });
console.log("y_range: " + BOKEH_PLOT_1.y_range);

The y_range is definitely getting set to the new range but it does not actually change on the graph
the console output:

y_range: Range1d(3C545F2E0040426280FF88B354C33B14) 
y_range: Range1d(34ED49BD0F604AD79DF3E1E15F868856)

Is there a way to change the y and x ranges so they actually change?

Is there a way to change the y and x ranges so they actually change?

You should change the start and end properties of the existing ranges, rather than replacing the entire range objects wholesale.

Thanks Bryan,

That worked.

Did the following:
Also worked for x axis

BOKEH_PLOT_1.y_range.start = MinY;
BOKEH_PLOT_1.y_range.end = MaxY;
1 Like