-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
plot is empty when log scale is used #3834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@sklam This seems to be due to a problem bokeh has in computing the min and max value for a range that is used with log axes. As a workaround, you could just specify a range yourself, and it should work. p = figure(y_axis_type="log", y_range=[10e-6, 10e-3]) When you don't put in a range yourself, then the default is to take the min and max of the data and add some padding to it, which is a percentage of the total range from data min to data max. The problem is that the padding is calculated linearly, which can cause problems in log plots, specifically when the padding is larger than the smallest data value. That causes the min value for the range to become negative, which is a problem for log axes since the log of a negative number is undefined. This issue about range_padding is also related. You could also compute a min and max value for the range using the range padding parameter in log space, something like: log_ys = np.log(ys)
log_range_padding = 0.2 * (log_ys[-1] - log_ys[0])
log_range = [log_ys[0] - log_range_padding, log_ys[1] + log_range_padding]
y_range = np.exp(log_range).tolist() #y_range is [2.354749231925326e-05, 0.0018717659249710699] And then you could go on and find the next n-th powers so that you end up with nice and even major ticks like |
This is still present on |
This is still present in 0.12.3. Can somebody please look at this? You have multiple very simple repro cases. It results in random failures in a really fundamental feature: log-scale plotting. |
Here's a suggestion for a simple fix for you: set range-padding to 0 when axis is log-scale. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bokeh incorrectly creates an empty plot with the following:
The problem only occurs if
y_axis_type="log"
is used.It seems when the range of y values is too narrow bokeh fails to compute the y-axis range. If I multiple the y values by 100, it plots properly.
Tested on bokeh version: 0.11.1 py34_0
The text was updated successfully, but these errors were encountered: