Legend loses gradient if shared between layers
See original GitHub issueThe following:
{
"layer": [{
"mark": { "type": "line" },
"encoding": {
"color": {
"type": "quantitative",
"field": "c"
}
}
}, {
"mark": { "type": "circle" },
"encoding": {
"color": {
"type": "quantitative",
"field": "c"
}
}
}],
"data": {"values": [{"c": 1}, {"c": 2}]}
}
This is surprising - I would have expected a gradient legend.
If a layer is removed (which one is removed doesn’t matter), the output is correct:
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Fill and Color Legend Disappear while Adding Layers
1 Answer 1 · The issue is I want the scales to be merged and share the same title. The issue is that...
Read more >Creating a gradient-based legend - qgis - GIS Stack Exchange
To get the legend to say High or Low, you can achieve this by deleting everything inside the Legend Format textbox and then...
Read more >Visualizing the vanishing gradient problem
Looking at the gradients of each layer; The Glorot initialization. Configuration of multilayer perceptron models. Because neural networks are ...
Read more >Vanishing and Exploding Gradients in Neural Network Models
Moving on to the exploding gradients, in a nutshell, this problem is due to the initial weights assigned to the neural nets creating...
Read more >Arrange a legend—ArcGIS Pro | Documentation
Reorder legend items by expanding the legend in the Contents pane to see the legend items. Drag items up or down in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think this is expected behavior
I think we could fix this in a few ways:
That said, since there is a good workaround, I’ll make this issue P3.
Okay, so the issue is that Vega uses a different legend when both fill and stroke are encoding a scale. That’s a bit surprising but also kinda makes sense since only a symbol can encode both gradient and fill.
Removing one or the other does not make sense in the general case so I think that the behavior is actually as expected.
If you want a gradient legend, you need to tell Vega-Lite with
"legend": {"type": "gradient"}
.