Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Animating the content of a title of a plot in Makie.jl

$
0
0

My “expected” way of animating the title of a plot does not work.

MWE:

using GLMakie
fig = Figure()
ax = fig[1,1] = Axis(fig)
s = Observable(0) # counter of current step
titlestr = lift(x -> "step = "*string(x), s)
ax.title = titlestr

produces

ERROR: MethodError: Cannot `convert` an object of type Observable{String} to an object of type String
Closest candidates are:
  convert(::Type{T}, ::T) where T<:AbstractString at strings/basic.jl:229
  convert(::Type{T}, ::AbstractString) where T<:AbstractString at strings/basic.jl:230     
  convert(::Type{S}, ::CategoricalArrays.CategoricalValue) where S<:Union{AbstractChar, AbstractString, Number} at C:\Users\datse\.julia\packages\CategoricalArrays\ZjBSI\src\value.jl:73
  ...

What is the correct approach?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles