Skip to content

Tag: altair

In Altair equality condition doesn’t work

I’m trying to build a scatterplot in Altair where the color of the points is determined by a slider. In this example, I want to color in orange only the carse whose cylinders are equal to the one selected by the slider. The operator == inside the Altair condition doesn’t work. I tried different op…

Reference local .csv file in altair chart

I’m trying to use altair to visualize data, but I struggle to use it in the way I would like to use it: by not embedding the data inside the generated .html chart, but by referencing the local .csv file that contains the data. Otherwise, it would result in duplicating the data and therefore doubling the…

Altair limit number of bars in facet chart

Suppose that I have a pandas dataframe like this one: I want to make a bar chart with altair, where the height of the bars is counts, and the label is the label. I want to add a facet by the column group. How do I limit the number of bars to be shown, if I want the top 3

How to load and plot csv file using altair package in python?

I have a csv file which has 200000 lines and I would like to plot the data files using altair packagae. Documentation states that for large files, data needs to be passed as URL. This is what I have till now. But this does not seem to work. Am I missing something obvious here? Answer When you pass a dataset

Plotting spatial data on individual map using altair

I want to plot spatial data on a map. I want to use streamlit because it seems to be easy to use and I want to explore it a bit. First a tried plotting my data with their inbuilt deck_gl-API. This worked pretty good, but since I need to plot glyphs/icons and the IconLayer isn’t built into streamlit yet,…