Skip to content

Tag: altair

How to get rid of the grey top and right line in Altair?

I was trying to visualise a result of linear regression. And I wanted to remove the top and right grey line. I have tried setting stroke=None, strokeWidth=0 and strokeOpacity=0 in global config but none of these worked. How can I get rid of them? Here’s my code and plot. enter image description here Ans…

Drawing a closed loop with Altair mark_line without repeating data

See this example and this similar question. I also want to draw a closed loop with mark_line in Altair. However, I am currently in the process of streamlining my code to be more data-efficient, which is presenting a wrinkle that I am having trouble with. I have a dataset of x and y data that I plot as a scatt…

Altair combine two charts

I am trying to plot/combine two charts on Altair, but only one of the chart is actually showing with the expected data. The second chart doesn’t show. The second chart is blank Code below: Image below: Answer If life is referring to life expectancy, the reason you don’t see the lines is the lower …

Change bubble size in altair without changing font size

I am trying to create a altair bubble chart. The sample code and sample dataframe is below: I want the size of the bubble based on Market_cap and put names of companies alongside. The problem is font size of names is also changing as per the bubble size. How can this I create this bubble chart with different …

Customize tooltip in Altair chart

I’m using Google Colab for learning Python. In this Google Colab notebook I’ve built for demostration, I was able to get some JSON data and visualize it with Altair. This is the chart image I got so far – you can interact with the data in the linked Google Colab notebook or directly in the v…

Some Altair charts fade

Updated: Changing alt.X(‘yearmonthdate(TimeUTC):T’ to alt.X(‘yearmonthdate(TimeUTC):O’ made the problem go away. See bottom of post. I have four years of data of the form: TimeUTC FlightID DroneType 2018-08-22 19:35:23.024386+00:00 2018-08-22 19:35:23+00:00 663f-46fe-8887-d37895745506 …