How to plot a simple scatter plot using ggplotd

Marc mailnawman at gmail.com
Tue Aug 12 02:23:49 UTC 2025


Hello everyone,
I am trying to use ggplotd to visualize a data set before and 
after fitting a linear model. how ever i'm struggling to get it 
to work with a simple example. I tried the following and i get 
errors for boths:

```d
import mir.ndslice;
import ggplotd.aes: aes, Aes;
import ggplotd.axes: xaxisLabel, yaxisLabel;
import ggplotd.ggplotd: GGPlotD, putIn;
import ggplotd.geom: geomPoint, geomBox, geomLine;

void main(){
    auto x = [1.47f, 1.50f, 1.52f].sliced(3);
    auto y = [52.21f, 53.12f, 54.48f].sliced(3);
    auto xs = x.array;
    auto ys = y.array;
    auto gg = aes!("x", "y")(xs, ys).geomPoint;
    // or
    auto gs = aes!("x", "y")(xs, ys).array.geomPoint;
}
```
I would appreciate any help or advice on getting it to work.


More information about the Digitalmars-d-learn mailing list