Part I · Fundamentals · Chapter 7

An introduction to encoding

A chart in SCImago Graphica is a set of connections between the variables in your data and the visual properties of the marks on the canvas. Making those connections is called encoding, and it is the one idea the rest of the manual builds on.

Marks and channels

Everything drawn on the canvas is a mark — a dot, a bar, a line, a slice, a country on a map. A mark has visual properties you can see: where it sits, how big it is, what color it takes, what shape it uses, what text rides on top of it.

Each of those properties is a channel you can connect a variable to. Connect Population to Size and every mark is scaled by its population. Connect Region to Color and every mark is colored by the region it belongs to. Nothing else changes: the same marks, re-described.

This is why a scatter plot, a bar chart and a treemap are not three separate tools in Graphica — they are three sets of connections. The chart wizard does present them as a gallery, and it is a perfectly good way to start, but what it hands you is an encoding like any other. Change the connections and the chart becomes something else, which is what makes exploring a dataset fast once the idea clicks.

The mark

What the marks are — circles, bars, slices — is not a channel but a setting of the whole chart: the first one under Marks, in the chart settings on the right of a chart tab. Its ten icons, whose names show when you point at them, are the ten kinds of mark Graphica draws:

The top of the Marks section of the chart settings: ten mark icons in two rows — none, circles (selected), squares, bars and lines; areas, filled area, filled map, radial chart and waffle chart — and below them Layout set to Default and Circle type, with the filled circle chosen rather than the outline or an image of your own.
Figure 1 — The mark of the chart, under Marks. With circles chosen, Circle type picks a filled circle, an outline or an image of your own.
MarkWhat it draws
NoneNothing you can see. The marks are still there, so their labels, tooltips and distribution plots are drawn: a word cloud is labels on marks of this kind.
CirclesA circle for each row (or each group, with a variable on Unit). The default. Circle type, beside Layout, makes it filled or an outline. Its third option draws an image of your own in its place (PNG or SVG), the same for every mark. The image keeps its colours unless you choose a Fill colour or put a variable on Color, which paint it.
SquaresA filled square, in the same places. Like a circle, it takes its area from Size, and the size legend draws squares too; Corner radius rounds its corners.
BarsA bar for each group, as long as its value.
LinesA line joining one point per group.
AreasThe same line, filled down to its axis.
Filled areaRectangles that fill the space they are given: treemaps, heat maps.
Filled mapThe regions of a map, filled. See Displaying geospatial data.
Radial chartPies, donuts, roses and radar charts. See Part-to-whole and hierarchies.
Waffle chartA grid of cells for each group, filled in proportion to its value, in the same chapter.

The mark decides more than the look. Circles and squares stand for rows, while bars, lines and the rest gather the rows of a group into one mark, so switching the mark of a chart can change the numbers on its axes — see An introduction to aggregation. The settings below the icons follow the mark: Circle type for circles, Chart type for a radial chart, Corner radius for squares and bars, and so on.

Where encoding happens

The left side of a chart tab holds two columns. First, the variables in your dataset. Next to them, the visual properties, one drop area each.

The variable list is split into Data source variables — the columns that came in with your file — and Computed variables, the ones you derived. Inside each group the variables are ordered by type: dates first, then categorical, then quantitative. If the list is long, the Search variables box at the foot of the list fades out, as you type, every variable whose name does not match.

The left side of a chart tab with nothing encoded: the variable list, with Data source variables and Computed variables and the Search variables box at the foot, and next to it the thirteen empty property slots, from Y-axis down to Animation and Filters.
Figure 2 — The variables in your dataset (left) and the visual properties they can be connected to (right).

Making a connection

Drag a variable from the list and drop it on the property you want it to drive. The variable stays in the list — you are dropping a copy, so the same variable can feed several channels at once. The chart redraws as soon as the drop lands.

Once a variable sits in a property, two things are available on it:

  • Click it to open its settings. Every channel has its own — a scale for an axis, a palette for color, a size range, a text template for a label. Those settings are the subject of later chapters.
  • Right-click it and choose Remove to disconnect it. The variable goes back to being unused; the data is untouched.
Dragging continent onto Color: a copy of continent sits in the Color slot under the cursor, while continent is still listed among the data source variables.
Figure 3 — Dropping a variable on a property. The original stays in the list, so one variable can drive several channels.

The thirteen channels

These are the properties you can encode to, in the order they appear in the panel. The second column is the name the property carries inside a .gph file, which you only need if you are reading or writing project files by hand.

PropertyIn the fileWhat it doesAcceptsVariables
Y-axis | rowsAXIS_YPlaces the mark vertically, or splits the canvas into rows.AnySeveral
X-axis | columnsAXIS_XPlaces the mark horizontally, or splits the canvas into columns.AnySeveral
SizeAREAScales the mark by value.QuantitativeOne
ColorCOLORColors the mark — a palette for categories, a gradient for numbers.AnyOne
LabelLABELWrites text on the mark.AnySeveral
TooltipTOOLTIPAdds information shown when the reader hovers the mark.AnySeveral
UnitUNITDecides what one mark represents. Without it, one row is one mark.CategoricalOne
Small MultiplesMULTIPLESRepeats the whole chart once per value, side by side.CategoricalOne
SubdivisionSUBDIVISIONSplits each mark internally by value.CategoricalSeveral
AlphaALPHASets the opacity of the mark by value.Quantitative or dateOne
ShapeSHAPEGives each category its own symbol.CategoricalOne
AnimationPLAYShows the chart one step at a time, one per value, with play/pause controls; marks travel from one step to the next. Lines and areas connected by the same variable keep the earlier steps, so they grow as it plays.Categorical or dateOne
FiltersFILTERRestricts which rows are drawn.AnySeveral

Three of them do something different in kind from the rest, and they are the ones worth understanding early. Unit, Small Multiples and Subdivision do not change how a mark looks — they change how many marks there are and what each one stands for. They get their own chapter next. Animation is different again: it decides which rows are on screen at each moment, and has a chapter of its own, Animating a chart.

Note

Project files also carry a fourteenth property, BLUR, which is not offered in the properties panel. You may see it in a hand-written .gph; you cannot assign it from the interface.

What each channel accepts

Not every variable fits every property, and the restrictions are not arbitrary — they follow from what the channel has to draw.

  • Categorical only — Shape, Small Multiples, Subdivision, Unit and Animation. Each of these needs a finite set of values to work with: one symbol per category, one panel per category, one slice per category, one step per category. A continuous number has no such set. A date can stand in for a category: each of its values, at the grain its aggregation sets, counts as one.
  • Quantitative only — Size. Area is a magnitude; it has to be computed from a number.
  • Quantitative or date — Alpha. Opacity is a magnitude too, but a date is an ordered scale, so it can drive one.
  • Anything — the two axes, Color, Label, Tooltip and Filters. These adapt: an axis fed a number becomes continuous and fed a category becomes a set of bands; color switches between a palette and a gradient the same way.

If a variable is not the type a channel expects, changing the type is often the real fix rather than choosing another channel — a year read as a number behaves differently from a year read as a date. See Data types.

One variable or several

Some properties hold exactly one variable, and dropping a second replaces nothing — it is simply rejected. Size, Color, Alpha, Shape, Unit, Small Multiples and Animation are all single-variable: a mark has one area, one color, one opacity, one symbol, and a chart plays through one sequence of steps.

The rest take as many as you need. Two variables on X-axis | columns nest one scale inside the other; several on Label or Tooltip stack into one block of text; several on Filters apply together.

Order matters on the axes

When you put several variables on the same axis, categorical variables have to come before quantitative ones. The axis is read outside in: the categories divide the space, and the numbers are measured inside each division. Dropping them the other way round is reported as The categorical variables must precede the quantitative ones in this axis.

Each division repeats the number's axis, and by default all of them share one scale: the divisions compare directly, but a small category lies flat next to a large one — a histogram per sport, with one sport far more crowded than the rest, say. Independent scales, in the panel of the inner axis, gives each division the scale of its own data. Limits you fix still hold in every division, so a minimum of 0 keeps each one starting at zero. It is not offered on the binned axis of a histogram, whose bins have to be the same in every division.

Several quantitative variables on one axis

Putting two or more numbers on the same axis — revenue and cost on X-axis | columns, say — splits the plot into one band per variable, side by side, each with its own axis scaled to its own range. That is the right default when the variables are measured in different units, and the wrong one when they share a unit and you meant to compare them: two bars of equal length then stand for entirely different amounts.

The settings that decide this sit in the panel of the axis itself, under Relationship with other axes:

  • Synchronize axis — makes every variable on that axis share one scale, taken from the smallest minimum and the largest maximum among them, so the bands are comparable. Turn it on whenever the variables are magnitudes of the same kind; leave it off when they are not.
  • Axis organization — offered when the axis holds exactly two variables. Independent is the side-by-side arrangement above; Dual overlays both variables in one plot with an axis on each side of it; Combined merges them into a single axis with a single scale.

When an assignment is not valid

An assignment Graphica cannot honor is not thrown away. It stays where you dropped it, marked as invalid, and hovering it tells you why. That way you can see the whole arrangement you were aiming for and fix the one piece that does not work.

MessageWhat happened
This visual property can only be used with categorical variables.A number landed on Shape, Small Multiples, Subdivision, Unit or Animation.
This visual property can only be used with quantitative variables.A category landed on Size.
This visual property can only be used with quantitative or date variables.A category landed on Alpha.
This visual property can not be assigned to more than one variable.A single-variable property already had one.
This variable has too many categories for this visual property (more than …).More than 100 categories on Shape, or more than 300 on Small Multiples — one symbol or one panel each would freeze the chart.
This variable has too many dates for this visual property (more than …). Click to group them by year, month or another date aggregation.The same limits, reached by a date — usually timestamps, where every row is a date of its own.
This variable has already been assigned to this visual property.The same variable was dropped twice on the same property.
The categorical variables must precede the quantitative ones in this axis.A category was placed after a number on an axis.
This computed variable cannot be used as a filter or an animation.The computed clusters variable was dropped on Filters or Animation.
This variable is not found in the dataset.The encoding refers to a column the current data does not have — usually after opening a project against a different file.
Income (GDP per capita) on Alpha, shown normally with its sum badge, and population on Shape, shaded red; hovering population shows: This visual property can only be used with categorical variables.
Figure 4 — An assignment that cannot be honored stays in place and explains itself on hover.

An invalid variable does not open its settings when clicked, with one exception: a date with too many values does, because the fix is in there. Set its Aggregation function to Year, Month or another grain coarse enough, and the assignment becomes valid on the spot — see Aggregating dates.

Channels that bring a legend

Four channels describe the marks in a way the reader cannot infer from the canvas alone, so Graphica adds a legend for them automatically: Size, Color, Shape and Alpha. The axes need no legend — they have their own scales — and the remaining channels either restructure the chart or write on it directly.

The size legend is the exception worth knowing: it is only drawn when the mark is a circle, a square or a line, the shapes whose size reads reliably. Encode Size on a bar chart and the bars will scale, but no size legend appears.

Each legend has its own settings — whether it shows, its position, its title and its font — in the panel of the variable that produced it. To get there from the chart, right-click the legend's title and choose Legend options.

A legend never takes more than half the chart: half the width beside it, half the height above or below. If it does not fit where it was placed, it moves to the other orientation — from a side to the bottom, from the top or bottom to the right — and if it does not fit there either it is left out until the chart has room for it again, at a larger size or with fewer entries. A legend set to floating takes no room, so it is always drawn.

A scatter plot of life expectancy against income per capita on a log scale, with population on Size and continent on Color. The population size legend and the continent color legend sit to the right of the plot, next to the property panel that holds those assignments.
Figure 5 — Two channels, two legends. Nothing was added by hand: encoding Color and Size produced them.

Choosing a channel

Once the mechanics are second nature, the question stops being can I and becomes should I. Channels are not equally precise. Readers compare positions accurately, lengths almost as well, then areas, then color intensity, and they barely compare opacity or symbol at all.

A practical order for building a chart follows from that:

  1. Put the comparison your chart is about on the axes.
  2. Use Color for the grouping you want the reader to notice second — categories, or a magnitude you want scanned rather than measured.
  3. Use Size for a magnitude that adds context but does not need to be read exactly.
  4. Use Shape and Alpha sparingly, for a small number of categories or a secondary distinction.
  5. Put everything else the reader might want on Tooltip, where it costs no ink.

The rule of thumb that survives longest: a channel that has to be decoded twice is a channel that is doing too much. Four encoded variables on one chart is usually plenty, and Small Multiples is often a better answer than a fifth.

Where to go next

The next chapter covers the three channels that restructure the chart rather than restyle it — Unit, Subdivision and Small Multiples — and with them the difference between a chart with one mark per row and a chart with one mark per group. From there, An introduction to aggregation explains what happens to the numbers when many rows collapse into one mark.