Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example scripts to documentation #383

Merged
merged 9 commits into from
Oct 27, 2022
Prev Previous commit
Next Next commit
Add altair script
  • Loading branch information
stefsmeets committed Oct 27, 2022
commit e9f170d8c68e5dc88eb2879b29366295a55dbf93
7 changes: 7 additions & 0 deletions docs/scripts/plot_with_altair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Plot with Altair

```python
{!../scripts/plot_with_altair.py!}
```

[Source code](https://github.com/duqtools/duqtools/tree/main/scripts/plot_with_altair.py)
12 changes: 12 additions & 0 deletions scripts/plot_with_altair.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from duqtools.api import ImasHandle, alt_line_chart

handle = ImasHandle.from_string('g2vazizi/jet/94875/8000')

x_var = 'rho_tor_norm'
y_var = 't_i_ave'

dataset = handle.get_variables(variables=(x_var, y_var))

chart = alt_line_chart(dataset, x=x_var, y=y_var)

chart.save('chart.html', scale_factor=2.0)