Skip to content

Commit

Permalink
Added support for animations with SeisPlotTX
Browse files Browse the repository at this point in the history
  • Loading branch information
firasalchalabi authored and AtilaSaraiva committed Aug 13, 2024
1 parent 275e6cf commit 0cf3723
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/seisPlotTX.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ julia> f, ax = SeisPlotTX(d);
Author: Firas Al Chalabi (2024)
"""
function seisPlotTX(d;
fig=nothing, gx=nothing, ox=0, dx=1, oy=0, dy=1, xcur=1.2, wiggle_trace_increment=1,
fig=nothing, ax=nothing, gx=nothing, ox=0, dx=1, oy=0, dy=1, xcur=1.2, wiggle_trace_increment=1,
pclip=98, vmin=nothing, vmax=nothing,
wiggle_line_color=:black, wiggle_fill_color=:black,trace_width=0.7,
wiggle_line_color=:black, wiggle_fill_color=:black, trace_width=0.7,
cmap=:seismic, style="image")

if isnothing(fig)
fig = Figure()
end

ax = __create_axis(fig[1,1])
if isnothing(ax)
ax = __create_axis(fig[1,1])
end

if style == "overlay"
overlay = seisoverlayplot!(ax, d;
Expand All @@ -63,12 +65,15 @@ function seisPlotTX(d;

Colorbar(fig[1, 2], overlay)

xlims!(ax, low=ox, high=ox+size(d,2)*dx)
xlims!(ax, low=to_value(ox), high=to_value(ox) + size(to_value(d), 2)*to_value(dx))

elseif style == "wiggles" || style == "wiggle"
if !isnothing(gx)
ox = gx[1]
dx = wiggle_trace_increment*minimum([gx[i]-gx[i-1] for i = 2:length(gx)])
if !isnothing(to_value(gx))
start = to_value(gx)[1]
diff = to_value(wiggle_trace_increment)*minimum([to_value(gx)[i]-to_value(gx)[i-1] for i = 2:length(to_value(gx))])
else
start = to_value(ox)
diff = to_value(dx)
end

seiswiggleplot!(ax, d; gx=gx, ox=ox, dx=dx, oy=oy, dy=dy, xcur=xcur,
Expand All @@ -77,13 +82,14 @@ function seisPlotTX(d;
wiggle_fill_color=wiggle_fill_color,
trace_width=trace_width)

xlims!(ax, low=ox-dx, high=ox+size(d,2)*dx)
xlims!(ax, low=start-diff, high=start + size(to_value(d), 2)*diff)

else
img = seisimageplot!(ax, d; ox=ox, dx=dx, oy=oy, dy=dy, pclip=pclip, vmin=vmin, vmax=vmax, cmap=cmap)
Colorbar(fig[1,2], img)

xlims!(ax, low=ox, high=ox+size(d,2)*dx)
xlims!(ax, low=to_value(ox), high=to_value(ox)+size(to_value(d),2)*to_value(dx))

end

return fig, ax
Expand Down

0 comments on commit 0cf3723

Please sign in to comment.