Can someone help me with this?

julia> using Graphs, GraphPlot

julia> using Symbolics, Statistics, LinearAlgebra

julia> using Plots, LaTeXStrings

julia> @variables p
1-element Vector{Num}:
p

julia> A=[1 2+p 3+p; 2+p 1 3+p; 4+p 5+p 1]
3×3 Matrix{Num}:
1 2 + p 3 + p
2 + p 1 3 + p
4 + p 5 + p 1

julia> A_eval=Matrix{Num}(substitute.(A,(Dict([p=>0.8]),)))
3×3 Matrix{Num}:
1 2.8 3.8
2.8 1 3.8
4.8 5.8 1

julia> heatmap(x=1:3,y=1:3,A_eval,lims=(0.5,3.5),aspectratio=1,c=:heat)
Stacktrace:
[1] getindex(h::Dict{Symbol, Any}, key::Symbol)
@ Base .\dict.jl:498
[2] RuntimeGeneratedFunctions.RuntimeGeneratedFunction(cache_tag::Type, context_tag::Type, ex::Expr; opaque_closures::Bool)
@ RuntimeGeneratedFunctions C:\Users\HP.julia\packages\RuntimeGeneratedFunctions\KrkGo\src\RuntimeGeneratedFunctions.jl:56
[3] _build_and_inject_function(mod::Module, ex::Expr)
@ Symbolics C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\build_function.jl:178
[4] _build_function(::Symbolics.JuliaTarget, ::Num; conv::Function, expression::Type, expression_module::Module, checkbounds::Bool, states::SymbolicUtils.Code.LazyState, linenumbers::Bool, wrap_code::Nothing, cse::Bool)
@ Symbolics C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\build_function.jl:122
[5] #build_function#337
@ C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\build_function.jl:83 [inlined]
[6] macro expansion
@ C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\plot_recipes.jl:8 [inlined]
[7] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{Num}, v::Num)
@ Symbolics C:\Users\HP.julia\packages\RecipesBase\qpxEX\src\RecipesBase.jl:289
[8] _apply_type_recipe(plotattributes::Any, v::AbstractArray, letter::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\type_recipe.jl:39
[9] _apply_type_recipe(plotattributes::Any, v::Surface, letter::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\type_recipe.jl:60
[10] macro expansion
@ C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\user_recipe.jl:126 [inlined]
[11] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, x::Any, y::Any, z::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesBase\qpxEX\src\RecipesBase.jl:289
[12] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\user_recipe.jl:36
[13] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\RecipesPipeline.jl:70
[14] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
@ Plots C:\Users\HP.julia\packages\Plots\yJrrq\src\plot.jl:216
[15] #plot#149
@ C:\Users\HP.julia\packages\Plots\yJrrq\src\plot.jl:91 [inlined]
[16] heatmap(args::Any; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
@ Plots C:\Users\HP.julia\packages\RecipesBase\qpxEX\src\RecipesBase.jl:410
[17] top-level scope
@ c:\Users\HP\OneDrive\Documents\kumail.jl:9

julia> using Graphs, GraphPlot

julia> using Symbolics, Statistics, LinearAlgebra

julia> using Plots, LaTeXStrings

julia> @variables p
1-element Vector{Num}:
p

julia> A=[1 2+p 3+p; 2+p 1 3+p; 4+p 5+p 1]
3×3 Matrix{Num}:
1 2 + p 3 + p
2 + p 1 3 + p
4 + p 5 + p 1

julia> A_eval=Matrix{Num}(substitute.(A,(Dict([p=>0.8]),)))
3×3 Matrix{Num}:
1 2.8 3.8
2.8 1 3.8
4.8 5.8 1

julia> heatmap(x=1:3,y=1:3,A_eval,lims=(0.5,3.5),aspectratio=1,c=:heat)
Stacktrace:
[1] getindex(h::Dict{Symbol, Any}, key::Symbol)
@ Base .\dict.jl:498
[2] RuntimeGeneratedFunctions.RuntimeGeneratedFunction(cache_tag::Type, context_tag::Type, ex::Expr; opaque_closures::Bool)
@ RuntimeGeneratedFunctions C:\Users\HP.julia\packages\RuntimeGeneratedFunctions\KrkGo\src\RuntimeGeneratedFunctions.jl:56
[3] _build_and_inject_function(mod::Module, ex::Expr)
@ Symbolics C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\build_function.jl:178
[4] _build_function(::Symbolics.JuliaTarget, ::Num; conv::Function, expression::Type, expression_module::Module, checkbounds::Bool, states::SymbolicUtils.Code.LazyState, linenumbers::Bool, wrap_code::Nothing, cse::Bool)
@ Symbolics C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\build_function.jl:122
[5] #build_function#337
@ C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\build_function.jl:83 [inlined]
[6] macro expansion
@ C:\Users\HP.julia\packages\Symbolics\J8IHJ\src\plot_recipes.jl:8 [inlined]
[7] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{Num}, v::Num)
@ Symbolics C:\Users\HP.julia\packages\RecipesBase\qpxEX\src\RecipesBase.jl:289
[8] _apply_type_recipe(plotattributes::Any, v::AbstractArray, letter::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\type_recipe.jl:39
[9] _apply_type_recipe(plotattributes::Any, v::Surface, letter::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\type_recipe.jl:60
[10] macro expansion
@ C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\user_recipe.jl:126 [inlined]
[11] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, x::Any, y::Any, z::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesBase\qpxEX\src\RecipesBase.jl:289
[12] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\user_recipe.jl:36
[13] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
@ RecipesPipeline C:\Users\HP.julia\packages\RecipesPipeline\OXGmH\src\RecipesPipeline.jl:70
[14] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
@ Plots C:\Users\HP.julia\packages\Plots\yJrrq\src\plot.jl:216
[15] #plot#149
@ C:\Users\HP.julia\packages\Plots\yJrrq\src\plot.jl:91 [inlined]
[16] heatmap(args::Any; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
@ Plots C:\Users\HP.julia\packages\RecipesBase\qpxEX\src\RecipesBase.jl:410
[17] top-level scope
@ c:\Users\HP\OneDrive\Documents\kumail.jl:8

I don’t know if there are better ways, but this works:

``````A = Symbolics.value.(A_eval) .|> Float64
heatmap(A)
``````
1 Like

Thank you very much it works for me