Real time plotting (with Makie)



Currently I’m trying to plot real-time measured values (force values from a robot controller). By real-time I mean, at a 125Hz frequency as the values arrive. I’m working with Makie and concluded to this code based on this issue.
I will just comment the above code:
I got the values over TCP as a string in a format of "[1.1, 2.2, 3.3, 4.4, 5.5, 6.6]\n".
Then I update a string Node to process it with readdlm(). Right after processing I push the new values into a “fix size” array. This function is used to make the “fix size behaviour”:

function pushTo!(A, newX, maxSize)
    if size(A, 1) < maxSize
        push!(A, newX)
        push!(A, newX)

After updating the arrays I use the lastUpdate node to update the plot. I throttle it down:

        if (current_time-lastUpdate[])/1000000 > UPDATE_LAT
            lastUpdate[] = current_time

where UPDATE_LAT is around 200 miliseconds. If that time is up, the next function is called to update the plot:

function updatePlot(val)
    fxNode[] = FxV
    fyNode[] = FyV
    fzNode[] = FzV
    txNode[] = TxV
    tyNode[] = TyV
    tzNode[] = TzV
    # update limits:
    for i in 1:6

Here’s an example picture what I’ve created (with some random noise):

I tried to lower the UPDATE_LAT value to like 100 ms, but then plotting freezes out.
Overall I’m happy that it works, but could it be improved? And is this the way to do this kind of plotting, or should I do something completely different?

Some version infos:

julia> versioninfo()
Julia Version 1.0.2
Commit d789231e99 (2018-11-08 20:11 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)
  JULIA_EDITOR = "C:\Users\cstamas\AppData\Local\atom\app-1.34.0\atom.exe" -a

(julia-RTPlot) pkg> st
    Status `C:\Users\cstamas\Documents\Coding\julia-RTPlot\Project.toml`
  [537997a7] AbstractPlotting v0.9.4 #master (  [6e4b80f9] BenchmarkTools v0.4.2
  [5789e2e9] FileIO v1.0.5
  [e9467ef8] GLMakie v0.0.4 #master (
  [ee78f7c6] Makie v0.9.1 #master (
  [510215fc] Observables v0.2.3

(I feel this post a bit unnecessary as my code is working, but I’m curious, if I made some mistake and/or how could I improve it.)