While using Plots.jl i am getting error UndefVarError: colorbar
not defined
Please code below
begin
fig = plot(size=(300, 300)) # figsize=(20, 20)
ax = fig[1]
# Define colormap
colormap = :jet
# Set plot limits and aspect ratio
xlims!(ax, (0, x_lim))
ylims!(ax, (0, y_lim))
aspect_ratio=print(ax)
# Define color range for density plot
vmin = 1e-8
vmax = 1e-2
# Create density plot
print(size(rho[1,:,:] .* v_p[1,:,:]))
density2 = heatmap!( rho[1,:,:] .* v_p[1,:,:], cbar=true, clim=(log(vmin), log(vmax)), xlabel="X", ylabel="Z", title="Density vs X-Z")
# Create contour plot
contour!( psi[1,:,:], levels=contour_levels, linecolor=:white, linewidth=4)
# Add colorbar
cbr = colorbar(density, label=L"\mathbf{\rm{log}_{10}(\rho{\rm v_p})}",
ticks=[log10(vmin), 0, log10(vmax)], ticklabels=["$vmin", "1", "$vmax"])
# Save the plot
savefig("plot.png")
@show density2
end