2
votes

I'm trying to resize my charts I've made with Bokeh. I've managed to make charts quite nicely and in all forms what i have wanted, but i don't know how to resize my charts in Holoviews. In Bokeh this was easy (plot_width etc.), but i haven't been able to figure it out in Holoviews. I've googled for solution the last 3 hours and all i get this errors, for example if i try to add an argument to hv.Bars(fig_size, width, height). I'm able to fetch the size of the graph, with .get_size, but unable to change it.

import pandas as pd
import numpy as np
import holoviews as hv
hv.extension('bokeh')
from bokeh.io import output_file, save, show
from bokeh.plotting import figure, output_file, show

station_info = pd.read_csv('2017_leimaustiedot_resursointi_v2.csv')


kaavio = hv.Bars(station_info, kdims=['Viikko'], vdims=['Kokonaisresu'])


renderer = hv.renderer('bokeh')
renderer.save(kaavio, 'graph.html')
plot = renderer.get_plot(kaavio).state
size1 = renderer.get_size(plot) # I get the size, but how to change it?
print(size1)
output_file("graph.html")
show(plot)
1

1 Answers

1
votes

I tried for hours and finally found the solution! By setting attributes to the Bokeh-object. Adding:

setattr(plot, 'plot_width', 1700)
setattr(plot, 'plot_height', 900)

I tried to do this for hours and i was just to about to give up and ask from StackOverflow until i figured this out.