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 operators, the ones working are >
Tag: altair
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 required storage. Here’s what
Altair Ridgeline doesn’t create a plot with nominal groups
I try to create a Ridgeline plot in altair. Let’s assume my dataframe consists of str and float columns: with values like I used code from Altair gallery to create my chart: https://altair-viz.github.io/gallery/ridgeline_plot.html. My code with changed data and column names: When I use row=alt.Row(‘a:T’…) it thinks my data is temporal month, but works fine: But when I change type
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 label the line from transform_regression using Altair?
The code below creates a regression line; however, the legend defaults to labeling the line as “undefined.” How can this regression line be labeled in the legend as “reg-line”? Answer Simply add .transform_fold([“reg-line”], as_=[“Regression”, “y”]).encode(alt.Color(“Regression:N”)) after mark line Code should look like
How to correctly shift the baseline in an area plot to a particular y location and change the fill color correspondingly, in Altair?
I wanted to be able to do something like this – NOTE: The horizontal line you see is NOT at y=0, but y=1 But using color or fill encoding with condition does not really work in area charts. The closest I got was using yOffset (hit and trial for the perfect value) in mark_area but the biggest problem with that
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, I