Skip to main content

A Visualization Engine and Renderer

Project description

Avenger: A visualization engine and renderer

Avenger is an early stage prototype of a new foundational rendering library for information visualization (InfoVis) systems. Avenger defines a 2D scenegraph representation tailored to the needs of InfoVis systems. To start with, the initial application of Avenger is to serve as an alternative, GPU accelerated, rendering backend for Vega visualizations.

Try it out in Python with Vega-Altair

The avenger Python package provides a custom Altair renderer named avenger-png. This renderer relies on vl-convert to extract the vega scenegraph corresponding to a chart and then uses Avenger to render the chart to a static PNG image.

First, install altair, vega-datasets, avenger, and vl-convert-python

pip install -U altair vega_datasets avenger "vl-convert-python>=1.2.3"

Then import Altair and activate the avenger-png renderer

import altair as alt
alt.renderers.enable('avenger-png', scale=1)

Then create and display an Altair chart as usual:

import altair as alt
from vega_datasets import data

source = data.cars()

chart = alt.Chart(source).mark_circle(size=60).encode(
    x='Horsepower',
    y='Miles_per_Gallon',
    color='Origin',
)
chart

cars_scatter

Or, convert the chart to a PNG rendered by Avenger:

import avenger
png = avenger.altair_utils.chart_to_png(chart, scale=1)
with open("scatter.png", "wb") as f:
    f.write(png)

Comparison to vl-convert

There aren't currently many advantages to using Avenger to render Altar charts to PNG as compared with vl-convert, which performs rendering using resvg. Performance is generally comparable, though Avenger can be a bit faster for charts with a large number of symbol instances.

One advantage is that Avenger's text rendering support is based on COSMIC Text, which supports emoji (unlike resvg's text handling). For example, here is the result of rendering the emoji example from https://altair-viz.github.io/gallery/isotype_emoji.html using Avenger:

isotype_emoji

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avenger-0.0.7.tar.gz (115.7 kB view hashes)

Uploaded Source

Built Distributions

avenger-0.0.7-cp38-abi3-win_amd64.whl (4.6 MB view hashes)

Uploaded CPython 3.8+ Windows x86-64

avenger-0.0.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.4 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

avenger-0.0.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.0 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

avenger-0.0.7-cp38-abi3-macosx_11_0_arm64.whl (3.4 MB view hashes)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

avenger-0.0.7-cp38-abi3-macosx_10_12_x86_64.whl (3.5 MB view hashes)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page