Hi,
I would like to add a point to a graph, like a heatmap.
It works fine if I do
plot!([1.],[1.],color="blue")
but if use
plot!([a.],[a.],color="blue")
where a is a variable Int64, I get the error unexpected ]. Removing ] does not change anything
Your issue is not really a plotting issue but a parsing issue. For legal numbers, the parser interprets a dot as shorthand for .0, but this doesn’t work for variables, where it is interpreted as field access (as in myobj.field)
.0
myobj.field
Consider:
julia> 1. 1.0 julia> a = 1 1 julia> [a.] ERROR: syntax: unexpected "]" julia> [a] 1-element Array{Int64,1}: 1
So try removing the dot in your code. For plotting points also consider using scatter instead of plot
scatter
plot
Very clear, it works now. Thanks.