Skip to content

Commit

Permalink
Merge pull request #6 from PainterQubits/#4-fix-plotting-of-datalogs-…
Browse files Browse the repository at this point in the history
…with-multiple-datavars

#4 Change data log load code to make separate plots
  • Loading branch information
alexhad6 authored Oct 20, 2023
2 parents b8b4658 + ea2f2f3 commit 49a78ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- JupyterLab plugin to preview PDF files in the file browser on hover.

### Changed

- Generated code to load data logs now plots data variables in separate plots.

## [0.1.0] (Oct 2 2023)

### Added
Expand Down
8 changes: 5 additions & 3 deletions src/utils/generateLoadCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ print(${varName}.data)`;
} else if (mimetype === NETCDF_MIMETYPE) {
loadFunction = "DataLog.load";
previewCode = `
for var_name in ${varName}.data:
print(f"${varName}.data[\\"{var_name}\\"]")
${varName}.data[var_name].plot()`;
for data_var_name in ${varName}.data:
print(f'${varName}.data["{data_var_name}"]')
plt.figure()
${varName}.data[data_var_name].plot()
plt.show()`;
} else {
loadFunction = "load_log";
previewCode = "";
Expand Down

0 comments on commit 49a78ec

Please sign in to comment.