1

I have a standalone plot which generates an .html file. The file itself is two plots below a title, using the code below, using this suggestion, where p and q are horizontal bar charts:

P = row(p,q)
div = Div(text=overallTitle)
save(column(div,P))

The result is this:

result

My aim is to centre align the text, so it is above the middle of the two charts, as well as change the font and size of the text. This answer suggests it can be done like this:

div.css_classes = ["my-custom"]

However, now it seems the CSS class "my-custom" needs to be created. This answer suggests (I think) that adding "a Div element with the style sheet" is the way to achieve that.

I have no experience with CSS at all, do I need to create a .css file that is stored in the same directory as the Python script which defines the function that creates the .html file? It may also be worth mentioning that I'd like to keep the .html file output format, I do make use of the interactive features that it provides, e.g. tooltips.

Any help much appreciated.

ChesuCR
  • 9,352
  • 5
  • 51
  • 114
OD1995
  • 1,647
  • 4
  • 22
  • 52
  • You have different options. You can use [`CSS_RESOURCES`](https://bokeh.pydata.org/en/latest/docs/reference/core/templates.html#bokeh.core.templates.CSS_RESOURCES) environment variable. You can use [`jinja templates`](https://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#standard-template) adding a `link` header to the css file location... though I do not know if this works for the standalone version, they should be in the `templates` folder – ChesuCR Oct 29 '18 at 19:26

0 Answers0