All Questions
20
questions
1
vote
2
answers
43
views
Altair chart legend for subset of data
As an exercise for learning more advanced altair, I'm trying to generate a simplified version of this chart: https://climatereanalyzer.org/clim/t2_daily/?dm_id=world.
To simplify, I'm using gray for ...
1
vote
0
answers
22
views
Untoggle *all* legend items in an Altair chart in a Jupyter notebook
I'm trying to create a chart with Altair in a Jupyter notebook. It's basically a line-chart of various currency values over time. I included my code below.
I can toggle currencies using the legend, ...
0
votes
1
answer
330
views
Altair - Remove ellipsis ("...") from legend with long strings
Via Python, I am using Altair to plot bar graphs. I was able to move the legend to be at the top, however, it is adding ellipsis (i.e. "...") at the end of each legend because my strings are ...
1
vote
2
answers
563
views
Altair: Discrete/Binned Color Scheme for Heatmap
I am trying to create a heatmap where the color scale is discrete, not continuous. I would like to use 5 colors, so I don't think a conditional statement will work. I found this example on Google ...
1
vote
1
answer
393
views
How to display only one series on Altair chart
For the interactive legend example, I was wondering if there is a way to display only one series and hide others on the chart after running the code. Then, when clicking on the legend, the chart can ...
1
vote
0
answers
481
views
Retain multi selection in Altair interactive legend when chart is clicked
I have created a compound bar chart in Altair with an interactive legend, where bars from one chart and legend elements can both be selected to filter another chart. This works well when only a single ...
2
votes
1
answer
1k
views
Merge two legends in altair
I have a scatter plot in altair where I am representing a column using both shape and color. I would like to have a single legend with both pieces of information, but instead I am getting two legends, ...
2
votes
2
answers
1k
views
Change legend number range in Altair plot
I am trying to plot time series data in a kind of "climate stripes plot" using the package Altair.
The problem is that I do not know how to change the range in the legend to standardise all ...
4
votes
1
answer
952
views
Format Altair choropleth map legend scale and tooltip
I am trying to make the tool tip 'Percentage' be an actual percent and not a decimal. Even when I include alt.Tooltip('Percentage:Q',format='.2%'), it doesn't seem to work.
Also, I am trying to make ...
0
votes
2
answers
648
views
Can we add an interactive legend to the interactive line chart in Altair?
Goals:
On mouseover in the line chart, increase the thickness of the line,
gray-out all other lines, and gray out all other items in the legend
as well. See interactive line chart.
On click in the ...
1
vote
1
answer
1k
views
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"?
...
2
votes
1
answer
1k
views
Altair - Interactive Legend to only show selected elements
I've got the following code
brush = alt.selection_interval()
selection = alt.selection_multi(fields=['Sex'])
color = alt.condition(selection,
alt.Color('Sex:N', legend=None),
...
3
votes
1
answer
877
views
Vega-Lite - One plot for multiple datasets
I'm working on a package for Julia with the goal of doing quick plots using Vega-Lite as backend.
As people familiar with Matplotlib know, it is very common to have different sets for vectors, and ...
0
votes
0
answers
498
views
Altair: Mark_rule legends with layered facets and another legend duplicate the legends
I have a bar chart for NPS values with a gradient legend. I'd like to display some static values with a legended mark_rule simultaneously, and finally facet the results. However, I can't find a way to ...
2
votes
1
answer
3k
views
Change shape color in an Altair legend
Consider the following code adapted from Altair website.
import altair as alt
import pandas as pd
source = pd.DataFrame({
'a': ['A', 'B', 'B', 'B', 'E', 'F', 'G', 'H', 'I'],
'b': [28, 55, 43, ...