holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.66k stars 397 forks source link

Bad formatting of y axis labels in scientific notation #4873

Open gioarma opened 3 years ago

gioarma commented 3 years ago

Software version info

holoviews 1.14.2 bokeh 2.3.0 python 3.8.5

Description of expected behavior and the observed behavior

The y axis labels overlap with y axis when numbers are expressed in scientific notation

Complete, minimal, self-contained example code that reproduces the issue

hv.Curve([1e-3,1.5e-3,2e-3])

Schermata 2021-03-26 alle 16 02 07

jbednar commented 3 years ago

That looks like a Bokeh rather than HoloViews issue.

gioarma commented 3 years ago

Doing everything in Bokeh I don't get the same issue, but maybe holoviews uses bokeh in a different way, I don't know

from bokeh.plotting import figure, show

x = [1, 2, 3, 4, 5]
y = [6e-12, 7e-12, 2e-12, 4e-12, 5e-12]
p = figure(title="Simple line example", x_axis_label="x", y_axis_label="y")
p.line(x, y, legend_label="Temp.", line_width=2)
show(p)

Schermata 2021-03-26 alle 16 17 18

philippjfr commented 3 years ago

How are you outputting the Curve plot? Looks like the output you get from saving to png.

gioarma commented 3 years ago

Ok, I understood it depends on the theme that you are using. With the default theme it's OK:

hv.Curve([1e-3,1.5e-3,2e-3])

Schermata 2021-03-29 alle 10 40 17

With the light_minimal theme I get the issue:

hv.renderer('bokeh').theme = 'light_minimal'
hv.Curve([1e-3,1.5e-3,2e-3])

Schermata 2021-03-29 alle 10 41 01

But I get the same issue doing everything in Bokeh, so it is indeed a Bokeh issue:

from bokeh.plotting import figure, output_file, show
from bokeh.themes import built_in_themes
from bokeh.io import curdoc

x = [1, 2, 3, 4, 5]
y = [6e-5, 7e-5, 6e-5, 4e-5, 5e-5]

curdoc().theme = 'light_minimal'
p = figure(title='light_minimal', plot_width=300, plot_height=300)
p.line(x, y)
show(p)

Schermata 2021-03-29 alle 10 44 42