All Questions
13
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 ...
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 ...
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"?
...
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, ...
3
votes
1
answer
1k
views
How to Expand All Legend Entries in Altair Plots
Consider the following simple example:
import altair as alt
from vega_datasets import data
alt.Chart(data.cars.url).mark_point().encode(
x='Horsepower:Q',
y='Miles_per_Gallon:Q',
color=...
4
votes
1
answer
11k
views
How to add legend to python altair
Can someone please help how to add legend for "Covid-19 Cases" and "Sales Volume" ?
In the chart, red is "COVID-19 Cases" and blue is the "Sales Volume". Thanks ...
3
votes
2
answers
12k
views
Adding legend to layerd chart in altair
Consider the following example:
import altair as alt
from vega_datasets import data
df = data.seattle_weather()
temp_max = alt.Chart(df).mark_line(color='blue').encode(
x='...
3
votes
1
answer
1k
views
Can you add a label for "missing data" to a legend for an Altair chart?
I have a heatmap plotted using Altair that includes a colorbar, but the missing data (blank/white) in the heatmap is not labeled on the colorbar. Is there a way to add a separate label to the legend (...
0
votes
1
answer
124
views
Size legend disappears when adding selection in scatterplot
This is how the legend must appear:
But I am getting this instead:
This is my code. When I don't add the selection, the legend appears normal. Am I forgetting to do any binding?
input_dropdown = ...