|
| 1 | +--- |
| 2 | +title: The grammar of graphics |
| 3 | +--- |
| 4 | + |
| 5 | +ggsql is a tool for visualising data, combining our 20 years of experience developing [ggplot2](https://ggplot2.tidyverse.org/) with a SQL-native syntax. |
| 6 | +Unlike most visualisation systems, ggsql has an underlying grammar, based on the [Grammar of Graphics](https://en.wikipedia.org/wiki/Wilkinson%27s_Grammar_of_Graphics) by Leland Wilkinson. |
| 7 | +This is a different approach than the one taken by most tools, which give you a set of pre-defined graphics, like scatterplots, bar charts, and pie charts. |
| 8 | +ggsql instead gives you a number of independent components that you can combine to solve a very wide set of problems. |
| 9 | + |
| 10 | +This means there's a learning curve to ggsql: you have to learn a few big ideas about the grammar before you can be productive. |
| 11 | +But we believe the payoff is worth it. |
| 12 | +The grammar gives you new vocabulary and new ways to think about visualizations. |
| 13 | +This allows you to create not only familiar graphics but also newer, better graphics. |
| 14 | +You'll gain the ability to look at a visualization that someone else has made, analyse the key components, then recreate it yourself. |
| 15 | +The hardest part of learning ggsql is likely to be unlearning the preconceptions that you bring over from previous visualization tools. |
| 16 | + |
| 17 | +We've tried to make the learning curve as easy as possible by keeping the grammar close to the SQL syntax that you're already familiar with. |
| 18 | +You'll start with a classic `SELECT` statement to get the data that you want. |
| 19 | +Then you'll use `VISUALIZE` (or `VISUALISE` 🇬🇧) to switch from creating a table of data to creating a plot of that data. |
| 20 | +Then you'll `DRAW` a layer that maps columns in your data to aesthetics (visual properties), like position, colour, and shape. |
| 21 | +Then you tweak the `SCALE`s, the mappings between the data and the visual properties, to make the plot easier to read. |
| 22 | +Then you `FACET` the plot to show how the relationships differ across subsets of the data. |
| 23 | +Finally you finish up by adding `LABEL`s to explain your plot to others. |
| 24 | +This allows you to produce graphics using the same structured thinking that you already use to design a SQL query. |
0 commit comments