Skip to content

Commit

Permalink
vis scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vpuri3 committed Feb 27, 2024
1 parent 304d162 commit 20cbb7d
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 255 deletions.
186 changes: 154 additions & 32 deletions figs/mf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ function makegrid(Nx, Ny)
x, y
end

#===============================#

Nxpts, Nypts = 20, 10
Nxsrf, Nysrf = 200, 100

Expand All @@ -38,64 +40,184 @@ zcrm = @. zfunc(xsrf, ysrf; ϵ = 2e-2)
zsnf = @. zfunc(xsrf, ysrf)
#===============================#

fig = Figure(
xy_label_kw = (;
xlabelvisible = false,
ylabelvisible = false,

xticksvisible = false,
yticksvisible = false,

xticklabelsvisible = false,
yticklabelsvisible = false,
)

z_label_kw = (;
zlabelvisible = false,
zticksvisible = false,
zticklabelsvisible = false,
)

#===============================#

fig1 = Figure(
size = (800, 800),
backgroundcolor = :white,
grid = :off,
)

ax1 = Axis3(fig[1,1];
title = L"Simulation snapshots embedded in parametric space $$",
ax1 = Axis3(
fig1[1,1];
title = L"Simulation snapshots embedded in parametric space$$",
titlesize = 32,

# viewmode = :fit,
azimuth = pi/4,
elevation = 0.3,
# aspect = (1, 1, 1),
limits = (-1.2, 1.2, -1.2, 1.2, 0, 1.1),

xlabelvisible = false,
ylabelvisible = false,
zlabelvisible = false,
xy_label_kw...,
z_label_kw...,
)

xticksvisible = false,
yticksvisible = false,
zticksvisible = false,
l1 = scatter!(ax1, xpts, ypts, zpts;
# color = :black,
color = vec(xpts .+ ypts),
colormap = [:red, :blue],
markersize = 15,
)

xticklabelsvisible = false,
yticklabelsvisible = false,
zticklabelsvisible = false,
t1 = text!(ax1, 1, 1, -0.2; text = L"\mathbb{R}^N", fontsize = 40)

#===============================#

fig2 = Figure(
size = (800, 800),
backgroundcolor = :white,
grid = :off,
)

t = text!(ax1, 1, 1, -0.2; text = L"\mathbb{R}^N", fontsize = 40)
ax2 = Axis(
fig2[1,1];
title = L"Snapshot coordinates on reduced manifold$$",
titlesize = 32,
limits = (-1.2, 1.2, -1.2, 1.2),
xy_label_kw...,
)

l = scatter!(ax1, xpts, ypts, zpts;
# color = :black,
l2 = scatter!(ax2, vec(xpts), vec(ypts);
color = vec(xpts .+ ypts),
colormap = [:red, :blue],
markersize = 15,
)

# surface!(ax1, xsrf, ysrf, zpca;
# color = 0*vec(xsrf),
# colormap = [:black, :black],
# alpha = 0.5,
# transparent = true,
# )
t2 = text!(ax2, 0, -1.2; text = L"\mathbb{R}^r", fontsize = 40)

# surface!(ax1, xsrf, ysrf, zsnf;
# color = 0*vec(xsrf),
# colormap = [:green, :green],
# alpha = 0.5,
# transparent = true,
# )
#===============================#

fig3 = Figure(
size = (800, 800),
backgroundcolor = :white,
grid = :off,
)

ax3 = Axis3(
fig3[1,1];
title = L"PCA fits hyper-plane to data$$",
titlesize = 32,
azimuth = pi/4,
elevation = 0.3,
# aspect = (1, 1, 1),
limits = (-1.2, 1.2, -1.2, 1.2, 0, 1.1),

xy_label_kw...,
z_label_kw...,
)

surface!(ax1, xsrf, ysrf, zcrm;
l3 = scatter!(ax3, xpts, ypts, zpts;
# color = :black,
color = vec(xpts .+ ypts),
colormap = [:red, :blue],
markersize = 15,
)

surface!(ax3, xsrf, ysrf, zpca;
color = 0*vec(xsrf),
colormap = [:black, :black],
alpha = 0.3,
alpha = 0.5,
transparent = true,
)

fig
#===============================#

fig4 = Figure(
size = (800, 800),
backgroundcolor = :white,
grid = :off,
)

ax4 = Axis3(
fig4[1,1];
title = L"We fit a nonlinear manifold to data$$",
titlesize = 32,
azimuth = pi/4,
elevation = 0.3,
# aspect = (1, 1, 1),
limits = (-1.2, 1.2, -1.2, 1.2, 0, 1.1),

xy_label_kw...,
z_label_kw...,
)

l4 = scatter!(ax4, xpts, ypts, zpts;
color = vec(xpts .+ ypts),
colormap = [:red, :blue],
markersize = 15,
)

surface!(ax4, xsrf, ysrf, zsnf;
color = 0*vec(xsrf),
colormap = [:green, :green],
alpha = 0.5,
transparent = true,
)

#===============================#

fig5 = Figure(
size = (800, 800),
backgroundcolor = :white,
grid = :off,
)

ax5 = Axis3(
fig5[1,1];
title = L"We fit a nonlinear manifold to data$$",
titlesize = 32,
azimuth = pi/4,
elevation = 0.3,
# aspect = (1, 1, 1),
limits = (-1.2, 1.2, -1.2, 1.2, 0, 1.1),

xy_label_kw...,
z_label_kw...,
)

l5 = scatter!(ax5, xpts, ypts, zpts;
color = vec(xpts .+ ypts),
colormap = [:red, :blue],
markersize = 15,
)

surface!(ax5, xsrf, ysrf, zcrm;
color = 0*vec(xsrf),
colormap = [:black, :black],
alpha = 0.3,
transparent = true,
)
#===============================#
save(joinpath(@__DIR__, "snapshot_ful.png"), fig1)
save(joinpath(@__DIR__, "snapshot_red.png"), fig2)
save(joinpath(@__DIR__, "snapshot_pca.png"), fig3)
save(joinpath(@__DIR__, "snapshot_snf.png"), fig4)
save(joinpath(@__DIR__, "snapshot_crm.png"), fig5)
#===============================#
nothing
Loading

0 comments on commit 20cbb7d

Please sign in to comment.