AoG/Makie: Axis sorted in alphabetical order

gruemelmonster
Fri, 26 Apr 2024 10:04:21 +0000
Visualization

I am trying to plot some measurement data using AoG. I am also pretty new to this, so I might be missing something obvious.

When I try to plot data that has string entries as an X-Axis, the values get sorted by alphabetical order. Is there a way I can prevent this and simply print in the order of the original data?

A quick example:

using AlgebraOfGraphics
using CairoMakie
using DataFrames

df = DataFrame(Measurement=["Simulation", "N1", "N2", "N3", "N10", "N11"], Values=[140.00,134.76,133.80,132.00,135.23,134.79])

measurementdata = data(df[!,[:Measurement, :Values]]);
measurementmapping = mapping(:Measurement, :Values);
layer = visual(Scatter)
draw(layer * measurementdata * measurementmapping)

As a result I get:

I would like to get the X-Axis in this order instead: Simulation, N1, N2, …, N10, N11

Does anyone know how to acheive this?

3 posts - 2 participants