ok, weird - the code works again. I put everything into a standalone svg.py script that I run simply with $ python svg.py.
The script is now as simplified as possible
import panel as pn
import holoviews as hv
import bokeh as bk
from bokeh.io import export_svgs, export_svg
import numpy as np
pn.extension()
hv.extension('bokeh')
# create the plots
plots = {(plotid):
hv.Points({'x': np.random.random(100),
'y': np.random.random(100)}
).opts(backend_opts={'plot.output_backend':'svg'})
for plotid in ['PLOT-A', 'PLOT-B']
}
# create the layout
holomap = hv.HoloMap(plots)
layout = hv.NdLayout(holomap).opts()
layout.opts(width=600)
# get the bokeh render and access the underlying layout bokeh stuff
renderer = hv.renderer('bokeh')
renderer = renderer.instance(mode='default')
r_layout = renderer.get_plot(layout)
# export the plots in the layout all in one SVG
export_svg(r_layout.state, filename='testNEW_layout_all_in_one.svg')
# export the plots in individual svg files
export_svgs(r_layout.state, filename='testNEW_layout_individual.svg')
Running it gives me the following output:
PS D:\tools\hansivex> python svg.py
C:\Python311\Lib\site-packages\holoviews\plotting\bokeh\plot.py:987: UserWarning: found multiple competing values for 'toolbar.active_drag' property; using the latest value
layout_plot = gridplot(
C:\Python311\Lib\site-packages\holoviews\plotting\bokeh\plot.py:987: UserWarning: found multiple competing values for 'toolbar.active_scroll' property; using the latest value
layout_plot = gridplot(
DevTools listening on ws://127.0.0.1:53827/devtools/browser/02520ec0-bffe-48be-8793-f2195fac9223
[0921/145634.645:INFO:CONSOLE(210)] "[bokeh] setting log level to: 'info'", source: file:///D:/tools/hansivex/bokehm8yflkp6.html (210)
[0921/145634.722:INFO:CONSOLE(192)] "[bokeh] document idle at 73 ms", source: file:///D:/tools/hansivex/bokehm8yflkp6.html (192)
[0921/145635.549:INFO:CONSOLE(210)] "[bokeh] setting log level to: 'info'", source: file:///D:/tools/hansivex/bokehnsgrj3lm.html (210)
[0921/145635.610:INFO:CONSOLE(192)] "[bokeh] document idle at 57 ms", source: file:///D:/tools/hansivex/bokehnsgrj3lm.html (192)
PS D:\tools\hansivex>
The resulting file looks like follows - a real svg one without embedded png. And it properly scales when opening in Firefox …
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="600" height="330"><defs><clipPath id="lQkmiJDpXian"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath><clipPath id="mDQwGlzuPPEg"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath><clipPath id="DTHSXvcCeknL"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath><clipPath id="LCIFHHNrLveU"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath><clipPath id="FnPfQxJZNpol"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath><clipPath id="IhcPLnxCgAJD"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath><clipPath id="TaGMizyFhrMi"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath><clipPath id="IMyPutyavaPt"><path fill="none" stroke="none" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z"/></clipPath></defs><path fill="rgb(0,0,0)" stroke="none" paint-order="stroke" d="M 0 0 L 600 0 L 600 330 L 0 330 L 0 0 Z" fill-opacity="0"/><g transform="matrix(1, 0, 0, 1, 0, 30)"><path fill="rgb(0,0,0)" stroke="none" paint-order="stroke" d="M 0 30 L 600 30 L 600 330 L 0 330 L 0 30 Z" fill-opacity="0"/><path fill="rgb(255,255,255)" stroke="none" paint-order="stroke" d="M 0.5 0.5 L 300.5 0.5 L 300.5 300.5 L 0.5 300.5 L 0.5 0.5 Z" fill-opacity="1"/><rect fill="#FFFFFF" stroke="none" x="52" y="29" width="238" height="226" transform="matrix(1, 0, 0, 1, 0.5, 0.5)"/><path fill="rgb(255,255,255)" stroke="none" paint-order="stroke" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z" fill-opacity="1"/><path fill="none" stroke="rgb(229,229,229)" paint-order="fill" d="M 52.5 29.5 L 290.5 29.5 L 290.5 255.5 L 52.5 255.5 L 52.5 29.5 Z" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10"/><path fill="rgb(48,162,218)" stroke="rgb(48,162,218)" paint-order="fill" d="M 220.38319213701658 210.86875915527344 A 1.224744871391589 1.224744871391589 0 0 1 217.93370239423342 210.86875915527344 A 1.224744871391589 1.224744871391589 0 0 1 220.38319213701658 210.86875915527344" fill-opacity="1" clip-path="url(#DTHSXvcCeknL)" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10"/><path fill="rgb(48,162,218)" stroke="rgb(48,162,218)" paint-order="fill" d="M 259.4652233870166 210.9312286376953 A 1.224744871391589 1.224744871391589 0 0 1 257.0157336442334 210.9312286376953 A 1.224744871391589 1.224744871391589 0 0 1 259.4652233870166 210.9312286376953" fill-opacity="1" clip-path="url(#DTHSXvcCeknL)" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10"/><path fill="rgb(48,162,218)" stroke="rgb(48,162,218)" paint-order="fill" d="M 147.65798766924314 130.05035400390625 A 1.224744871391589 1.224744871391589 0 0 1 145.20849792645998 130.05035400390625 A 1.224744871391589 1.224744871391589 0 0 1 147.65798766924314 130.05035400390625" fill-opacity="1" clip-path="url(#DTHSXvcCeknL)" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10"/><path fill="rgb(48,162,218)" stroke="rgb(48,162,218)" paint-order="fill" d="M 271.8914013655322 168.8401336669922 A 1.224744871391589 1.224744871391589 0 0 1 269.44191162274905 168.8401336669922 A 1.224744871391589 1.224744871391589 0 0 1 271.8914013655322 168.8401336669922" fill-opacity="1" clip-path="url(#DTHSXvcCeknL)" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10"/><path fill="rgb(48,162,218)" stroke="rgb(48,162,218)" paint-order="fill" d="M 125.2844372542041 116.4220199584961 A 1.224744871391589 1.224744871391589 0 0 1 122.8349475114209 116.4220199584961 A 1.224744871391589 1.224744871391589 0 0 1 125.2844372542041 116.4220199584961" fill-opacity="1" clip-path="url(#DTHSXvcCeknL)" stroke-opacity="1" stroke-linejoin="bevel" stroke-miterlimit="10"/><path fill="rgb(48,162,218)" stroke="rgb(48,162,218)" paint-order="fill" d="M 201.11024291826658 87.79862976074219 A 1.224744871391589 1.224744871391589 0 0 1 198.66075317548342 87.79862976074219 A 1.224744871391589 1.224744871391589 0 0 1 201.11024291826658 87.79862976074219" fill-opacity="1" clip-path="url(#DTHSXvcCeknL)" stroke-opacity="1" stroke-linejoin="bevel" strok .....
I install my modules via pip (running everything on a Windows10 OS).
phantomjs 1.4.1
selenium-4.12.0
holoviews-1.17.1
bokeh-3.2.2
hmm …