vega / vl-convert

Utilities for converting Vega-Lite specs from the command line and Python
BSD 3-Clause "New" or "Revised" License
84 stars 9 forks source link

axis label limit cutoff not considered when saving as file #152

Closed mattijn closed 4 months ago

mattijn commented 4 months ago

See https://github.com/altair-viz/altair/discussions/3336

import vl_convert as vlc
from IPython.display import Image
vl_spec = '''
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "values": [
      {"a": "J", "b": 28, "c": "I'm a very long axis label and eventhough my axis label is cutoff, I'm still rendered in the png"},
      {"a": "B", "b": 55},
      {"a": "C", "b": 43},
      {"a": "D", "b": 91},
      {"a": "E", "b": 81},
      {"a": "F", "b": 53},
      {"a": "G", "b": 19},
      {"a": "H", "b": 87},
      {"a": "I", "b": 52}
    ]
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "a", "type": "nominal"},
    "y": {"field": "c", "type": "nominal"},
    "color": {"field": "c", "legend": null}
  }
}
'''
png_data = vlc.vegalite_to_png(vl_spec=vl_spec)
Image(png_data)

Screenshot 2024-02-23 162713

jonmmease commented 4 months ago

Fix was just published in version 1.2.4