Skip to content

Instantly share code, notes, and snippets.

@garyfeng
Created June 2, 2016 13:40
Show Gist options
  • Save garyfeng/9516714839c84a1982dda74dd5f14a6c to your computer and use it in GitHub Desktop.
Save garyfeng/9516714839c84a1982dda74dd5f14a6c to your computer and use it in GitHub Desktop.
Adding a transparent background image to Plot.ly's SVG output. Two changes: (a) set opacity in `<g class="subplot xy" style = "opacity:0.5">`, and (b) adding an image in the "layer-below >> imagelayer" group.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@garyfeng
Copy link
Author

garyfeng commented Jun 28, 2016

Uh, apparently I didn't realize the function is already built-in. See https://github.com/plotly/plotly.js/blob/master/test/image/mocks/layout_image.json

and the corresponding PNG

https://github.com/plotly/plotly.js/blob/master/test/image/baselines/layout_image.png

The question is whether I can save it as a SVG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment