简体   繁体   中英

Changing the "save as" filename for Altair chart in google colab

I'm using altair in google colab and would like to create and download charts with a custom filename instead of 'visualization.svg'. I need to do this for about ~50 charts, I don't mind clicking 'export as SVG' for each, but having to open and check each one and then rename it is going to be quite a pain. I would ideally like to do the following:

for field in fields:
  chart = make_chart(field)
  chart.display(filename=field)

After digging through their code I found the options definition for vega-embed , which is populated from the kwargs in chart.display(..) and the one needed is downloadFileName .

for field in fields:
  chart = make_chart(field)
  chart.display(downloadFileName=field)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM