I have a method for resizing the plot, it just calculates the min and max x and y of all visible lines, then adds some padding, and sets the x and y range start and end. When I call this method from a button press, it works fine. It also works fine in when called from a checkbox on/off that turns lines visible/invisible . But when I call resize from a method that creates a line by calling my_figure.line, the plot won’t resize.
def resize():
#sets the plot to some standard size if there are no lines visible or existent
if len(line_onOff.active) == 0 or len(line_onOff.labels)==0:
plot.x_range.start = ts_to_epoch(df['Date'].min()) #converts timestamps to epoch
plot.x_range.end = ts_to_epoch(df['Date'].max())
plot.y_range.start = 0
plot.y_range.end = 100
else:
xmin,xmax,ymin,ymax = calc_range(lines) # "lines" is a list of line-type GlyphRenderers made from my_figure.line
plot.x_range.start = xmin #"calc_range()" finds the overall min and max of the lines x and y values
plot.x_range.end = xmax
plot.y_range.start = ymin
plot.y_range.end = ymax
x and y ranges are initially set to DataRange1d(start= some_value, end=some_other_value)

