I have just started using hvPlot today, as part of Panel.
I am having a difficult time figuring out how to disable scientific notation in my plots. For example here is a simple bar plot. The axis and the tootltip are in scientific notation. How can I change the format to a simple int?
I am showing this to non numerical and non techy management. They would rather see just basic integers and I don’t want to have to explain to them what scientific notation is.
I could not find anything in the docs to help me: https://hvplot.holoviz.org/user_guide/Customization.html
I’ve also tried to cobble together suggestions from Bokeh docs.
I can’t figure it out. Please help! Thanks
My simple df:
local_date amount
0 Jan 19 506124.98
1 Feb 19 536687.28
2 Mar 19 652279.31
3 Apr 19 629440.06
4 May 19 703527.00
5 Jun 19 724234.08
6 Jul 19 733413.32
7 Aug 19 758647.44
8 Sep 19 782676.16
9 Oct 19 833674.28
10 Nov 19 864649.74
11 Dec 19 849920.47
12 Jan 20 857732.52
13 Feb 20 927399.50
14 Mar 20 1152440.49
15 Apr 20 1285779.35
16 May 20 1431744.76
17 Jun 20 1351893.95
18 Jul 20 1325507.38
19 Aug 20 1299528.81
And code:
df.hvplot.bar(height=500,width=1000)
You can specify the formatter you would like to use in either x- or y-axis ticks, as such:
According to the Customization page you also referenced, the
xformatter
andyformatter
arguments can accept "printf formatter, e.g. '%.3f', and bokeh TickFormatter". So, another way to do it is by passing a customformatter
fromboken.models.formatters
and customize it as such (Note: there's many other formatters you can also explore). For example:Both should give you a result like this:
Now, editing the hover tooltip format is a bit tricker. One way to do it is to assign the figure object as custom
HoverTool
, in the following fashion:You can find more details on how to configure a custom
HoverTool
here.