Skip to content
Discussion options

You must be logged in to vote

It could just be how you create your plot in OJS.

Using a data object shows the plot

---
format: html
---

```{python}
import numpy as np

ojs_define(x=np.linspace(-10, 10, 20).tolist())

```

```{ojs}
function quad(x, a=3, b=2, c=1) {
    return x.map(x => a * (x ** 2) + b * x + c);
}

data = x.map(xi => ({x: xi, y: quad([xi])[0]}))

Plot.plot({
    marks: [
        Plot.line(data, {x: "x", y: "y"})
    ]
})
```

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kamransoomro84
Comment options

@kamransoomro84
Comment options

Answer selected by kamransoomro84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
ojs-engine Issues with the ojs engine
2 participants