SVG#
Download this notebook from GitHub (right-click to download).
import panel as pn
pn.extension()
The SVG
pane embeds an .svg
image file in a panel if provided a local path, or will link to a remote image if provided a URL.
Parameters:#
For layout and styling related parameters see the customization user guide.
alt_text
(str, default=None): alt text to add to the image tag. The alt text is shown when a user cannot load or display the image.embed
(boolean, default=False): If given a URL to an image this determines whether the image will be embedded as base64 or merely linked to.link_url
(str, default=None): A link URL to make the image clickable and link to some other website.encode
(bool, default=False): Whether to base64 encode the SVG, when enabled SVG links may not work.object
(str or object): The svg file to display. Can be a string pointing to a local or remote file, or an object with a_repr_svg_
method.style
(dict): Dictionary specifying CSS styles
The SVG
pane can be pointed at any local or remote .svg
file. If given a URL starting with http
or https
, the embed
parameter determines whether the image will be embedded or linked to:
svg_pane = pn.pane.SVG('https://upload.wikimedia.org/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg', width=300, height=400)
svg_pane
Like any other pane, the SVG
pane can be updated by setting the object
parameter:
svg_pane.object = 'https://upload.wikimedia.org/wikipedia/commons/1/1a/SVG_example_markup_grid.svg'
Download this notebook from GitHub (right-click to download).