Image
Edit this page// Single View Specification
{
"data": ... ,
"mark": "image",
"encoding": ... ,
...
}
Image marks allow external images, such as icons or photographs, to be included in Vega-Lite visualizations. Image files such as PNG or JPG images are loaded from provided URLs.
Documentation Overview
Image Mark Properties
// Single View Specification
{
...
"mark": {
"type": "image",
...
},
"encoding": ... ,
...
}
An image
mark definition can contain any standard mark properties and the following special properties:
Property | Type | Description |
---|---|---|
url | URI | ExprRef |
The URL of the image file for image marks. |
aspect | Boolean | ExprRef |
Whether to keep aspect ratio of image marks. |
align | String | ExprRef |
The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of Note: Expression reference is not supported for range marks. |
baseline | String | ExprRef |
For text marks, the vertical text baseline. One of For range marks, the vertical alignment of the marks. One of Note: Expression reference is not supported for range marks. |
Examples
Scatterplot with Image Marks
Image Config
// Top-level View Specification
{
...
"config": {
"image": ...,
...
}
}
The image
property of the top-level config
object sets the default properties for all image marks. If mark property encoding channels are specified for marks, these config values will be overridden.
The image config can contain any image mark properties (except type
, style
, and clip
).