The y_range is getting calculated by a union of the y1 and y2 data columns. I.e., y1 has data from 0-50; y2 has data from 35-100; the union is 0-100 shown on both axes. If I remove the y2 line, then I get the correct range (0-50) on the left axis.
DataRange1d no longer has a "columns" property (probably for more than a year now). Instead of doing a simple envelope over column data, data ranges now ask individual renderers for their preferred bounds (this way auto ranging works correctly takes the "extent" of glyphs into account, which a naive envelope over the coordinates does not). By default the DataRange1d looks at all available renderers, but you can configure a specific set of renderers with the "renderers" property, described here:
I'm trying to setup a chart with two y axes, and I'm having trouble with the axis ranges.
# pandas data frame; column are 'x', 'y1', 'y2'
cds = ColumnDataSource(pd.df)
# setup the plot
p = figure(...)
# add the right y-axis
p.extra_y_ranges['y2axis'] = Range1d(start=0, end=100)
p.add_layout(LinearAxis(y_range_name='y2axis'), 'right')
# add the line glyphs
p.line(x=x,y=y1, source=cds)
p.line(x=x,y=y2, source=cds, y_range_name='y2axis')
# what's the correct syntax for autosetting the 'y' axis range from just the 'y1' column?
# this used to be correct prior to 0.9 release, but 'sources" has been removed as an argument.
p.y_range = DataRange1d(sources=[cds.columns('y1')])
The y_range is getting calculated by a union of the y1 and y2 data columns. I.e., y1 has data from 0-50; y2 has data from 35-100; the union is 0-100 shown on both axes. If I remove the y2 line, then I get the correct range (0-50) on the left axis.