Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Altair plots responsive

Can one make Altair plots fit the screen size, rather than have a pixel-defined width and height? I've read things about autosize "fit", but I am unsure about where to specify these.

like image 484
herman Avatar asked Mar 14 '19 18:03

herman


People also ask

Is Altair interactive?

Altair's interactivity and grammar of selections are one of its unique features among available plotting libraries. In this section, we will walk through the variety of selection types that are available, and begin to practice creating interactive charts and dashboards.

How do you annotate in Altair?

You can get annotations into your Altair plots in two steps: Use mark_text() to specify the annotation's position, fontsize etc. Use transform_filter() from datum to select the points (data subset) that needs the annotation. Note the line from altair import datum.

How do I get rid of gridlines on Altair?

We can remove the grid lines on x or y-axis by specifying the argument grid=False inside alt. X() or alt. Y() method in the encoding channels.


1 Answers

There is no way to do this. The dimensions of Altair/Vega-Lite charts are pre-determined by the chart specification and data, and cannot be made to scale with the size of the browser window.

like image 140
jakevdp Avatar answered Oct 07 '22 23:10

jakevdp