Composable data visualizations
Journal of Functional Programming, vol. 31, 2021
When visualizing data, you have to choose between high-level data visualization libraries such as Google Charts or low-level libraries like D3. In high-level libraries, you specify the type of chart you want, but you are limited to the features that the author of the library implemented. With low-level libraries, you have full control over the look of the chart, but you have to tediously transform your values to coordinates in pixels yourself.
What would an elegant functional approach to data visualization look like? A functional programmer would want a domain-specific language that has a small number of primitives that allow us to define high level abstractions such as a bar chart, but does not limit what we can do. When creating charts, we should be able to use domain values such as a currency exchange rate, rather than pixels in its basic building blocks.
As is often the case with domain-specific languages, finding the right primitives is more of an art than science. For this reason, we present our solution, a library named Compost, as a functional pearl. We hope to convince the reader that Compost is elegant and we illustrate this with a wide range of examples
Paper and more information
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
Watch a short video presentation associated with the JFP paper:
If you want to cite the paper, you can use the following BibTeX information.
1: 2: 3: 4: 5: 6: 7: 8: 9:
If you have any comments, suggestions or related ideas, I'll be happy to hear from you! Send me an email at firstname.lastname@example.org or get in touch via Twitter at @tomaspetricek.
Published: Thursday, 17 June 2021, 12:00 AM
Author: Tomas Petricek
Typos: Send me a pull request!