From e4dd9922fbf26d4a23f832156bee63908be6283e Mon Sep 17 00:00:00 2001 From: Emmanuel Lujan Date: Thu, 13 Jun 2024 20:52:36 -0400 Subject: [PATCH] Reducing image size in documentation via DisplayAs package. --- docs/Project.toml | 1 + examples/ACE-aHfO2/Project.toml | 1 + examples/ACE-aHfO2/fit-ace-aHfO2.jl | 9 +++++---- examples/DPP-ACE-Na/fit-dpp-ace-na.jl | 2 +- examples/LJ-Ar/Project.toml | 1 + examples/LJ-Ar/lennard-jones-ar.jl | 14 +++++++------- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index bb9e3f00..603cc361 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -3,6 +3,7 @@ AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Determinantal = "2673d5e8-682c-11e9-2dfd-471b09c6c819" +DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" diff --git a/examples/ACE-aHfO2/Project.toml b/examples/ACE-aHfO2/Project.toml index 8efc5a5d..ef28ea22 100644 --- a/examples/ACE-aHfO2/Project.toml +++ b/examples/ACE-aHfO2/Project.toml @@ -1,6 +1,7 @@ [deps] AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" +DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6" InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/examples/ACE-aHfO2/fit-ace-aHfO2.jl b/examples/ACE-aHfO2/fit-ace-aHfO2.jl index 4a1f6483..58e9a7f0 100644 --- a/examples/ACE-aHfO2/fit-ace-aHfO2.jl +++ b/examples/ACE-aHfO2/fit-ace-aHfO2.jl @@ -1,6 +1,7 @@ using AtomsBase, InteratomicPotentials, PotentialLearning using Unitful, UnitfulAtomic using LinearAlgebra, Random +using DisplayAs path = joinpath(dirname(pathof(PotentialLearning)), "../examples/ACE-aHfO2") @@ -110,13 +111,13 @@ test_metrics e_plot = plot_energy(e_train, e_train_pred, e_test, e_test_pred) @save_fig path e_plot -e_plot +DisplayAs.PNG(e_plot) # Plot and save force results f_plot = plot_forces(f_train, f_train_pred, f_test, f_test_pred) @save_fig path f_plot -f_plot +DisplayAs.PNG(f_plot) # Plot and save training force cosine e_train_plot = plot_energy(e_train, e_train_pred) @@ -125,7 +126,7 @@ f_train_cos = plot_cos(f_train, f_train_pred) @save_fig path e_train_plot @save_fig path f_train_plot @save_fig path f_train_cos -f_train_cos +DisplayAs.PNG(f_train_cos) # Plot and save test force cosine e_test_plot = plot_energy(e_test, e_test_pred) @@ -134,5 +135,5 @@ f_test_cos = plot_cos(f_test, f_test_pred) @save_fig path e_test_plot @save_fig path f_test_plot @save_fig path f_test_cos -f_test_cos +DisplayAs.PNG(f_test_cos) diff --git a/examples/DPP-ACE-Na/fit-dpp-ace-na.jl b/examples/DPP-ACE-Na/fit-dpp-ace-na.jl index 54a5bb3b..37ebd57f 100644 --- a/examples/DPP-ACE-Na/fit-dpp-ace-na.jl +++ b/examples/DPP-ACE-Na/fit-dpp-ace-na.jl @@ -51,7 +51,7 @@ println("MAE: $e_mae, RMSE: $e_rmse, RSQ: $e_rsq") # Plot energy error scatter e_err_train, e_err_test = (e_train_pred - e_train), (e_test_pred - e_test) dpp_inds2 = get_random_subset(dpp; batch_size = 20) -scatter( e_train, e_err_train, label = "Training", color = :blue, +p = scatter( e_train, e_err_train, label = "Training", color = :blue, markersize = 1.5, markerstrokewidth=0) scatter!(e_test, e_err_test, label = "Test", color = :yellow, markersize = 1.5, markerstrokewidth=0) diff --git a/examples/LJ-Ar/Project.toml b/examples/LJ-Ar/Project.toml index 715139f1..eb7ce7a0 100644 --- a/examples/LJ-Ar/Project.toml +++ b/examples/LJ-Ar/Project.toml @@ -1,5 +1,6 @@ [deps] AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a" +DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6" InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" diff --git a/examples/LJ-Ar/lennard-jones-ar.jl b/examples/LJ-Ar/lennard-jones-ar.jl index 44a5be2c..27467790 100644 --- a/examples/LJ-Ar/lennard-jones-ar.jl +++ b/examples/LJ-Ar/lennard-jones-ar.jl @@ -1,6 +1,6 @@ using Unitful, UnitfulAtomic using AtomsBase, InteratomicPotentials, PotentialLearning -using LinearAlgebra, Plots +using LinearAlgebra, Plots, DisplayAs # Load dataset: Lennard-Jones + Argon path = joinpath(dirname(pathof(PotentialLearning)), "../examples/LJ-Ar") @@ -24,11 +24,11 @@ p = plot(xlabel = "τ | ps", for i = 1:n_atoms plot!(time_range, map(x->x[i], dists_origin), label="") end -p +DisplayAs.PNG(p) # Plot LJ energies vs time -plot(time_range, energies, - xlabel = "τ | ps", - ylabel = "Lennard Jones energy | eV", - dpi = 300, fontsize = 12) - +p = plot(time_range, energies, + xlabel = "τ | ps", + ylabel = "Lennard Jones energy | eV", + dpi = 300, fontsize = 12) +DisplayAs.PNG(p)