I'm looking for a way to export a huge Graph generated with pyvis in to a vector graphic .svg or at least .png format. Is there a way to do it? So far I've only found the option to save / export as .html file.
Thanks in advance.
I'm looking for a way to export a huge Graph generated with pyvis in to a vector graphic .svg or at least .png format. Is there a way to do it? So far I've only found the option to save / export as .html file.
Thanks in advance.
For me this worked:
def generate_png(url_file, name): from playwright.sync_api import sync_playwright
with sync_playwright() as p:
for browser_type in [p.chromium]:
browser = browser_type.launch()
page = browser.new_page()
file = open(url_file, "r").read()
page.set_content(file, wait_until="load")
page.wait_for_timeout(30000)
page.screenshot(path=f'{name}.png', full_page=True)
file.close()
browser.close()
© 2022 - 2024 — McMap. All rights reserved.