These are chat archives for jheinen/GR.jl

22nd
Sep 2016
DeadbraiN
@tmptrash
Sep 22 2016 06:09
If you need more details, just let me know ;)
Josef Heinen
@jheinen
Sep 22 2016 06:24
@tmptrash : it seems that your scripts produces something like a heatmap, right? Could you send me a typical output (image)?
Josef Heinen
@jheinen
Sep 22 2016 06:37
@tbreloff : I installed GR master on a fresh Ubuntu 16.04 and everything works fine (transparency with GKS_WSTYPE=cairox11, PNGs, ...). Could you check the file GR/deps/lib/cairoplugin.so? Should look something like this:
jheinen@mbpro-vm:~/.julia/v0.5$ ls -l GR/deps/gr/lib/cairoplugin.so 
-rwxr-xr-x 1 jheinen jheinen 7608120 Sep 15 09:35 GR/deps/gr/lib/cairoplugin.so
jheinen@mbpro-vm:~/.julia/v0.5$ sum GR/deps/gr/lib/cairoplugin.so 
44761  7430
jheinen@mbpro-vm:~/.julia/v0.5$ ldd GR/deps/gr/lib/cairoplugin.so 
    linux-vdso.so.1 =>  (0x00007ffe4f3c8000)
    libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007f8d3c731000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f8d3c3f7000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8d3c074000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d3bd6b000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d3b9a2000)
    /lib64/ld-linux-x86-64.so.2 (0x0000559beb43f000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8d3b78b000)
    libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f8d3b583000)
    libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f8d3b369000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f8d3b146000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d3af42000)
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f8d3ad3d000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f8d3ab38000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f8d3a932000)
You have to remember this ;) We discussed it in august :)
It
It draws dots in real time on a canvas
Josef Heinen
@jheinen
Sep 22 2016 12:50
@tmptrash : The communication between GR and macOS is serialised. In your case, for each pixel (or at least with every workstation update) the display list (containing all points and attributes) has to be transferred to the GKSterm application. This is very inefficient. I'd suggest to draw the points in your own cell array and then use the gr.cellarray() function to update the screen. Mapping your points into a cell array should be easy - but I can make an example if required.
DeadbraiN
@tmptrash
Sep 22 2016 13:03
In my case its impossible, because i havent all points all together. Their coordinates transferred by network in real time...
Any other ideas?
Josef Heinen
@jheinen
Sep 22 2016 13:09
@tmptrash : Couldn't you transform the points into a cell array on the fly? Do you know the maximum extent/limits of the points?
DeadbraiN
@tmptrash
Sep 22 2016 13:10
I have only one point at the time
Josef Heinen
@jheinen
Sep 22 2016 13:11
There is no gr.setwindow() call in your dot() function, so, it seems, that you know the x- and y-range of the points. right?
DeadbraiN
@tmptrash
Sep 22 2016 13:27
no. it's not. i obtain coordinates through network by portions
with different delays
Josef Heinen
@jheinen
Sep 22 2016 13:29
@tmptrash : wrote an example:
using GR

xmin = -3
xmax = 3
ymin = -3
ymax = 3

resx = resy = 300

setviewport(0, 1, 0, 1)
setwindow(xmin, xmax, ymin, ymax)

cells = zeros(Int32, resx, resy)

while true
    x, y, color = randn(), randn(), round(Int, rand() * 255)
    ix = round(Int, (resx - 1) * (x - xmin) / (xmax - xmin)) + 1
    iy = round(Int, (resy - 1) * (y - ymin) / (ymax - ymin)) + 1
    if 1 <= ix <= resx && 1 <= iy <= resy
        println("$ix, $iy, $color")
        cells[ix, iy] = 1000 + color
    end
    clearws()
    setcolormap(13)
    cellarray(xmin, xmax, ymin, ymax, resx, resy, cells)
    updatews()
end
x, y, color are the points, colors you get in real-time
you can then map those points into a given cellarray ...
DeadbraiN
@tmptrash
Sep 22 2016 13:42
yes. i understand. but i need to show them in real time, without delays ;(
so i can't wait for several points, because them may be obtained with huge delay. Also, in this case "the video" will blink.
anyway, as i understand, it's impossible to fix this for dots drawing?
Josef Heinen
@jheinen
Sep 22 2016 14:12
@tmptrash : In this example, each point is shown as it "arrives". To avoid flickering, you can enable double buffering : export GKS_DOUBLE_BUF=1
DeadbraiN
@tmptrash
Sep 22 2016 14:29
I will try :) thanks
Tom Breloff
@tbreloff
Sep 22 2016 14:45
@jheinen my cairoplugin looks the same as yours
Tom Breloff
@tbreloff
Sep 22 2016 15:07
julia> ENV["GKS_WSTYPE"] = "cairox11"
"cairox11"

julia> using Plots; gr(); scatter(rand(100),rand(100),alpha=0.2)
GKS: /home/tom/.julia/v0.5/GR/deps/gr/lib/cairoplugin.so: undefined symbol: XRenderCompositeText32
Josef Heinen
@jheinen
Sep 22 2016 16:43
Screen Shot 2016-09-22 at 18.40.05.png
@tbreloff : Weird. I can produce your results with Plots, but with plain GR it works.
ENV["GKS_WSTYPE"] = "cairox11"
using GR
n = 500; x, y = rand(n), rand(n); area = pi .* (15 .* rand(n)).^2;
scatter(x, y, area, 1:n, alpha=0.5)
Tom Breloff
@tbreloff
Sep 22 2016 16:48
hmmm... ok at least we have something to trace that's not related to the system... any thoughts what might be different in Plots?
double buffering??
Josef Heinen
@jheinen
Sep 22 2016 16:49
No, there must be duplicate shared objects (.so) for the X run-time when using Plots.
Tom Breloff
@tbreloff
Sep 22 2016 16:50
well, since you can reproduce locally, i'm hoping you'll be able to figure it out without me!! :)
Josef Heinen
@jheinen
Sep 22 2016 16:50
The ldd cairoplugin.so command should give different results with or without Plots - I'll check that ...
Josef Heinen
@jheinen
Sep 22 2016 16:58
How can I run an external program within the Julia context? run() seems to use the shell context ...
Josef Heinen
@jheinen
Sep 22 2016 17:57

@tbreloff : Very strange. The following sequence works:

julia> ENV["GKS_WSTYPE"] = "cairox11"
"cairox11"
julia> using GR
julia> GR.scatter(rand(100),rand(100),alpha=0.5);
julia> using Plots; gr(); Plots.scatter(rand(100),rand(100),alpha=0.2)
[Plots.jl] Initializing backend: gr

Omitting the GR.scatter() call causes the unresolved global error !?!?!

Josef Heinen
@jheinen
Sep 22 2016 18:04
What's that supposed to mean?
Tom Breloff
@tbreloff
Sep 22 2016 18:11
i just looked through that code and didn't see anything obvious
Josef Heinen
@jheinen
Sep 22 2016 19:33
I suspect one of Plots' deps changes the LOAD_PATH. Still looking ...
Tom Breloff
@tbreloff
Sep 22 2016 21:32
FYI your GR.scatter example above fails for me