Skip to content

Instantly share code, notes, and snippets.

@a-lexwein
Last active July 10, 2019 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-lexwein/880a4393039a826ddb014a857668e519 to your computer and use it in GitHub Desktop.
Save a-lexwein/880a4393039a826ddb014a857668e519 to your computer and use it in GitHub Desktop.
Idea for a presentation/workshop on data viz and set theory

Questions to guide feedback:

  1. is it totally incomprehensible?
  2. does it sound like the type of workshop you'd actually want to go to?
  3. how do I turn this into a pitch to share with the organizers?
  4. I've never been to an unconf before, and I'm not sure the current version is unconference-y enough. How do I make more unconference-y.
  5. Do you know of other resources I should check out to inform my thinking here? (less important for getting the pitch out)

Sets, Relations, Functions, and Charts - a talk, maybe

So, this ties together a ideas that have stuck with me from a few places:

  1. "Bridge to Advanced Mathematics", a course I took in undergrad on sets/relations/functions.
  2. My grad school classwork extending those ideas into higher order logic and formal languages http://coffeeblack.org/publications/Pollard-Martin-FFLT.pdf.
  3. my grad school experience teaching set theory and logic to undergrads from a linguistics perspective in one of those classes that people can take instead of a "real" math class.
  4. Working with data, making data visualizations, and "learning to code".

Also, this is starting to feel like too much ground to cover. It might get bigger before it gets smaller, but I am confident I can deliver something taut and worthwhile.

Beyond the material itself, the workshop is about:

  1. Navigating notation, definitions, and jargon without getting bogged down in every step.
  2. The joys of abstraction and the ability to think of a thing in two ways at the same time.
  3. Understanding connections between different conceptual spaces (how is a chart like a sentence? You might think dplyr verbs are like verbs in English, but they're also kind of like adjectives.)

Chart similarity

Motivation for the formalism that follows: there are a lot of different ways to break up the chart space besides line charts vs bar charts. There's not one right way to divide up the space, but thinking about similarity in different ways is illucidating. This should make for good slides!

  1. same data, different charts.
  2. same charting function, different data.
  3. same data, same mapping to visual elements, but different...
    1. axis ranges
    2. size and aspect ratio
    3. color scheme, font, title (things that are explicitly encoded but outside of the grammar of graphics)
    4. .png vs .svg
    5. On paper vs on a computer
  4. Same data and chart (down to file type), but different context.

Sets, Relations (a kind of set), and Functions (a kind of relation)

Sets are defined in solely in terms of membership. An element is either in a set or not in the set, and that's basically all there is to sets.

An element of a set can be a set itself.

Subsets, Supersets, (Powersets maybe)

Intersection, Union, Complement

ordered pairs and cartesian products

Once you define cartesian product, you get a very simple a relation: a subset of a cartesian product...or just a set of ordered pairs.

once you have this definition of a relation, a function is just a relation where everything in the first set is in exactly one pair.

One-to-One (injective) Onto (Surjective)

One-to-One + Onto = Invertible (bijective)

Relations in the real world

  1. is taller than
  2. is at least as tall as
  3. is the parent child
  4. is the ancestor of
  5. is the brother-in-law of
  6. Has more privilege than (Eugenia Cheng, Category Theory in Life, https://www.youtube.com/watch?v=ho7oagHeqNc)
  7. is friends with vs is facebook friends with
  8. Verbs that relate people to propositions
    1. believes
    2. knows
    3. doubts

Equivalence relations

An equivalence relation has these properties:

  1. Reflexive
  2. Symmetric
  3. Transitive

Return to Chart Similarity, now with equivalence relations!

Data structures as relations

Directed graphs are just relations. Once you understand this, other data structures are just special types of graphs and hence special types of relations.

A linked list is a type of tree, which is a type of DAG, which is a type of directed graph. (But this is only true if you don't care about speed and other implementation details.)

Undirected graphs are just directed graphs that are symmetric (ie, if a is related to b, then b is related to a)

Nouns, Verbs, and Sentences

There are a lot of places to go with the linguistics angle, and I'm not exactly sure where I'll end up (or if I should cut it out entirely). Right now, maybe focus on syntax trees and some basics of categorial grammar (a verb phrase can be thought of as a function from noun phrases to sentences).

dplyr verbs in R, and map-filter-reduce and other array transformations in JS

This is partially a love letter to the pipeline operator (%>% in R), but it's really all about breaking big transformations into a series of small transformations.

manipulating charts

A look at the R package Patchwork which and magick (an API for imagemagick in R) for composing charts. Patchwork is secretly one of my very favorite data vis tools. Basically, just like you can combine two sentences and get another sentence ("and", "but", "then") when you compose two data visualizations, what you get back is a data visualization!

The magick piece is based on a charting idea I've playing with, in which I used a reduce function on a list of images to get a single image.

Stoner thought: Maarten Lambrechts's Xenographics grid implies there's a xenographic operator that takes two chart types and returns a new chart type. So what happens when you combine two xenographics???

Charts in context

My Tapestry talk focused on how within a fixed context (same data, same audience, same question) different charts convey different meaning. This version will take the chart and data as fixed, and show how varying the context impacts meaning, using the intuitions and formal tools built up in previous sections.

What's this have to do with category theory?

Everything! But maybe only because I don't understand what category theory is.


Related Viz Work:

Not sure where this fits in

Vickers, Faith, Rossiter https://arxiv.org/pdf/1311.4376.pdf Understanding Visualization: A Formal Approach using Category Theory and Semiotics

  • I haven't fully dove into this

An Algebraic Process for Visualization Design Kindlmann, Scheidegger https://vis.cs.ucdavis.edu/vis2014papers/TVCG/papers/2181_20tvcg12-kindlmann-2346325.pdf

Elijah Meeks touches on similarity a little with these categories: graphical, task, technical, semantic https://medium.com/@Elijah_Meeks/exploratory-design-in-data-visualization-87bc60ce7f04

I probably ought to actually read Wilkson's Grammar of Graphics too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment