Altair: Looking for equivalent of display() method in altair 2.0

Created on 9 Apr 2018  路  2Comments  路  Source: altair-viz/altair

Hi,
Long-time lurker, first time poster...
In my data exploration, I used to for-loop over a list of columns in a pandas dataframe and produce a simple graph for each column, and also display some stats run on each column. When I used the previous version of Altair, I used to loop and use the display method on a chart to get all the charts to display.

for colname in colList:    
    c = alt.Chart(data=ag).mark_bar().encode(y='Source', x=colname, color='Source')    
    c.display()    
    print(getstats(colname))    

However, in 2.0, that's no longer an available method. When i run this without the c.display(), I don't get any charts displayed. I don't want to vconcat because I want to display the stats interleaved. There's much I don't understand about rendering.
Any guidance is much appreciated!

Vinod

question

Most helpful comment

Hi Vinod,
The display() method is no longer in Altair because the system by which charts are rendered has been completely reworked since v1.

But you can get this behavior using the IPython.display.display() function; e.g.

from IPython.display import display
display(chart1)
display(chart2)

All 2 comments

Hi Vinod,
The display() method is no longer in Altair because the system by which charts are rendered has been completely reworked since v1.

But you can get this behavior using the IPython.display.display() function; e.g.

from IPython.display import display
display(chart1)
display(chart2)

That works beautifully. Thanks for your answer and more generally for building these tools!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jtbaker picture jtbaker  路  3Comments

bmcfee picture bmcfee  路  3Comments

floringogianu picture floringogianu  路  3Comments

Juan-132 picture Juan-132  路  3Comments

pabloinsente picture pabloinsente  路  3Comments