vega / vega-lite

A concise grammar of interactive graphics, built on Vega.
https://vega.github.io/vega-lite/
BSD 3-Clause "New" or "Revised" License
4.69k stars 616 forks source link

Color scale legend does not show max value #4144

Closed epietrig closed 6 years ago

epietrig commented 6 years ago

First thanks for developing vega-lite. Yet another great project from UW/IDL.

Setting a legend for the color scale (see attached screenshot force_values), it seems a bit odd that the max value does not appear as a label on the color scale. I realize I can force this using explicit values, as shown in the second screenshot, but I would expect this to be the default behavior?

Maybe linked to the fact that this is a temporal/timeUnit==year legend?

I do have data points with discovered == 2018, as the tooltip in the screenshot testifies.

Using vega-lite 3.0.0-rc4.

exoplanet.eu_catalog.csv.zip

donot_force_values force_values

{
    "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
    "data": {
        "url": "exoplanet.eu_catalog.csv",
    },
    "transform": [
        {"filter": {"field": "mass", "valid": true}},
        {"filter": {"field": "star_mass", "valid": true}},
        {"filter": {"field": "detection_type", "oneOf": ["Radial Velocity", "Primary Transit", "Microlensing"]}},
    ],
    "mark": "point",
      "encoding": {
        "x": {"field": "star_mass", "type": "quantitative", "axis":{"title": "Star Mass (Msun)"}},
        "y": {"field": "mass", "type": "quantitative", "axis":{"title": "Mass (Mjup)"}},
        "color": {"field": "discovered", "type": "temporal", "timeUnit": "year", "legend": {"title": "Year Discovered"}},
        "shape": {"field": "detection_type", "type": "nominal", "legend": {"title": "Detection Method"}},
        "tooltip": [{"field": "# name", "type": "nominal"}, {"field": "discovered", "type": "temporal", "timeUnit": "year"}]
      }
}```
domoritz commented 6 years ago

I believe this is the intended behavior in Vega but I will have to check in detail later.

domoritz commented 6 years ago

Quantitative legends do not show labels for the extreme values. I can't find the corresponding Vega issue but it's intended behavior.