## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Sebastian Skejø
@sebastianskejoe
Thanks! And tbx and tby are given as percentages of the window, right?
Sebastian Skejø
@sebastianskejoe
Any idea why plot(rand(100), size=(600,400)) and plot(rand(100), size=(300,400)) gives different tby? I don't see why changing the x-size would affect the y-size of the text.
Josef Heinen
@jheinen
All viewport limits (and text or marker heights) are internally handled as normalized device coordinates. Otherwise, text rotation/scaling or window resize operations would not be consistent (on different output devices).
Viktor Petukhov
@VPetukhov
Hi @jheinen, could you please comment on transiting GR to BinaryBuilder (jheinen/GR.jl#339 )? That's the only thing I need to build transferable binaries of my package, so I'd be happy to help with whatever is needed to get this done.
Josef Heinen
@jheinen
@VPetukhov : You can set ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder" (in GR#master), but there are still some issues.
Josef Heinen
@jheinen
Isn't a dockerized version a "transferable binary" ? See https://mybinder.org/v2/gh/jheinen/GR.jl/master
Viktor Petukhov
@VPetukhov

Thanks, I'll check that!

Isn't a dockerized version a "transferable binary"

Not really. It requires docker to be installed and is also trickier to use than just running a binary.

CheverDing
@dingzhw

This is probably related to Plots. As a workaround, you can force GR to use GKSTerm as the default output device using the GKSwstype environment (in your script or in your shell):

ENV["GKSwstype"]="gksqt"

I was using Julia 1.2.0 in Win 10 . and run into the problem that when I plot with GR it show the error message that

GKS: X11 support not compiled in

the command I quote is useful, thanks!

Andreas
@AndiMD
Hi! I am trying to use GR and QML for plots. It works fine on Linux, but fails on Windows with GKS: Qt5 support not compiled in. See also barche/QML.jl#107. Is there an easy way to fix that? Thanks
steve
@steven-varga
Hello! I am trying to add arc(...) geometry to GRUtils. Can someone tell me how to rotate GR.arc(x1,x2, y1,y2, arc1, arc2) ? I tried GR.setspace and GR.setspace but couldn't get the arc off the x axis.
Josef Heinen
@jheinen
@steven-varga : Could you please provide a use case and help me to better understand why you want to rotate arcs. May be, there is another solution which better suites your needs. What should you output look like?
@AndiMD : We are currently trying to integrate Qt5 in the GR Distribution for Windows. As it turns out, not an easy undertaking - but it's starting to take shape.
steve
@steven-varga
@jheinen thanks for the quick the response. It is to plot positive definite matrices, about 10^7 of them :) -- which can be factored as an R rotation or eigen vectors and L lambda principal axes. I perused the C source code, and noticed how GR.arc is implemented. On the bright side -- and some reading later -- I learned to bang the problem into 4 segmented bezier curves -- which I can do with GR.
@jheinen the output should be an ellipse with centered as (x,y) .> 0 with rotation matching the eigen vectors of a Positive Definite Matrix (PSD) within a coordinate system, where both axes have the same step size (same scales)
I am a researcher in computational finance, where PSD-s may represent risks of some sort.
Andreas
@AndiMD
@jheinen Thanks! Glad to hear this is being worked on.
Josef Heinen
@jheinen
@steven-varga : Then you probably are looking for sth like this:
function rotate(x, y, angle)
θ = angle * π / 180
x .* cos(θ) - y .* sin(θ), x .* sin(θ) + y .* cos(θ)
end

function drawellipse(x, y, angle, a, b)
p = [ 0 1 0.5523 1 1 0.5523 1 0 1 -0.5523 0.5523 -1 0 -1 -0.5523 -1 -1 -0.5523 -1 0 -1 0.5523 -0.5523 1 0 1 ]
Δx, Δy  = rotate(p[1:2:end] .* a, p[2:2:end] .* b, angle)
path(x .+ Δx, y .+ Δy, "MCCCCf")
end
steve
@steven-varga
yes, this is it -- thanks a lot!!! Below is the sketch -- I only added a memo indicating where the magic number 0.5523 is from, plus changed f: close path and fill to s: close path and stroke, I made the modifications to GRUtils.jl by adding ellipse. Will send you the modification for review on the GRUtils.jl github page, if that is OK? I also have a question:
there should be several variants of the ellipse: 1 - just stroke, 2 - filled, 1 - stroke + semi axis drawn; The GRUtils.jl argument passing mechanism is pretty awesome -- can you, or someone point to the right direction to express the above?
steve
@steven-varga
(the ellipse is clipped on purpose)

ellipse(x, y, angle, a, b; kwargs...])
ellipse([x, y, angle, a, b]; kwargs...)

Draw an ellipse with points i,j and major and minor axes a,b centered at x,y: $\frac{(i - x)^2}{a^2} + \frac{(j - y)^2}{b^2} = 1$

• linewidth: line width scale factor.
• linecolor: hexadecimal RGB color code for the line.

example:

ellipse([3.25, +1.25, 35.0, -1.2, +.8], linewidth=2, xlabel="xlabel", ylabel="ylabel", xlim=(0.0, 4.0), ylim=(0, 3.0))
ellipse(3.25, +1.25, 35.0, -.2, +.2, linewidth=2, xlabel="xlabel", ylabel="ylabel", xlim=(0.0, 4.0), ylim=(0.,3.0))

within geometries.jl

function rotate_ellipse_(x, y, angle)
θ = angle * π / 180
x .* cos(θ) - y .* sin(θ), x .* sin(θ) + y .* cos(θ)
end

function draw(g::Geometry, ::Val{:ellipse})::Nothing
GR.setborderwidth(float(get(g.attributes, :linewidth, 1.0)))
GR.setbordercolorind(1)

x,y, angle, a, b = g.x[1], g.x[2], g.x[3], g.x[4], g.x[5]
# constant 0.55228474 = 4.0*tan(π/8)/3.0 = 4.0*tan(π/8)/3.
p = [ 0 1 0.55228474 1 1 0.55228474 1 0 1 -0.55228474 0.55228474 -1 0 -1 -0.55228474 -1 -1 -0.55228474 -1 0 -1 0.55228474 -0.55228474 1 0 1 ]
Δx, Δy  = rotate_ellipse_(p[1:2:end] .* a, p[2:2:end] .* b, angle)
GR.path(x .+ Δx, y .+ Δy, "MCCCCs")

return nothing
end
mmtung
@mmtung
Hi! I'm currently trying to use Julia on an aarch64 architecture (RP 400). All packages except for GR install smoothly. The issue with GR under aarch64 seems to be the wrong download link for gr-0.55.0-Linux-aarch64.tar.gz. Could the developers look into this? Many thanks. -Mike
Josef Heinen
@jheinen
Which OS are you using on your RP4? We (only) provide gr-0.55.0-Debian-aarch64.tar.gz.
mmtung
@mmtung
Hi I'm using Arch Linux...
...the file Julia is looking for is gr-0.55.0-Linux-aarch64.tar.gz. Many thanks for the speedy reply!
Josef Heinen
@jheinen
We only have a CI runner for Raspbian. So you have to build GR from source or simply try the above distribution, e.g. by extracting the tar file in /usr/local.
mmtung
@mmtung
OK I will try the latter by installing the GR distro in /usr/local. Hope Julia GR finds it.
Josef Heinen
@jheinen
If it works, I can change the build script ...
mmtung
@mmtung
Alright. I will let you know.
mmtung
@mmtung

I just installed gr manually to local. But the Julia installation keeps on insisting to download:

┌ Error: Error building GR:
│ tar (child): Error is not recoverable: exiting now
│ tar: Child returned status 2
│ tar: Error is not recoverable: exiting now
│ ┌ Error: Download failed: curl: (22) The requested URL returned error: 404
│ ┌ Error: Download failed: curl: (22) The requested URL returned error: 404
│ [ Info: Using insecure connection
│ ┌ Error: Download failed: curl: (22) The requested URL returned error: 404
│ ERROR: LoadError: failed process: Process(tar xzf downloads/gr-0.55.0-Linux-aarch64.tar.gz, ProcessExited(2)) [2]

Probably GR is installed only locally into the Julia compilation directories (on user level). Maybe GR Julia should check for the system variable and replace 'Debian' by 'Linux', so this would hopefully cover other Linux distros as well.
mmtung
@mmtung
I believe to have found a temporary workaround: After changing build.jl in ~/.julia/packages/GR/9Vi4m/deps. When one changes
"tarball = "gr-$version-$os-$arch.tar.gz" to "tarball = "gr-$version-Debian-$arch.tar.gz" compilation runs smoothly. Also "using Plots" compiles. Will do some checking with the Plots package in a while. mmtung @mmtung Checks with "using Plots" give no problems. So the fix for future releases would be to modify in build.jl the if clauses starting in line 98. For Arch Linux with aarm64 the variables turn out to be arch=aarch64 and os=Linux, nevertheless it should be os=Debian. This could be captured in an additional elseif statement after line 114 in build.jl . Could this be done in the next update? Misha Mikhasenko @mmikhasenko Hey guys. I need some quick fixes for printing in latex \langle \rangle, and \mathit{\Omega}. Currently, it does not work. Could somebody point me to how the latex works in GR? Josef Heinen @jheinen Doesn't the following script work for you? using GR using LaTeXStrings settextfontprec(232,3) mathtex(0.1, 0.5, L"\langle \rangle, and \mathit{\Omega}") ... which uses the builtin LaTeX renderer. Unfortunately, the \mathit{} macro is ignored with the builtin renderer. Josef Heinen @jheinen But everything should work if you omit settextfontprec() - the text will then be rendered using your local LaTeX installation. Josef Heinen @jheinen @mmtung : Could you please check String(read(pipeline(cat /etc/os-release, grep ^$key=, cut -d= -f2)))[1:end-1] on your system?
mmtung
@mmtung

Hi Josef, many thanks for looking into this. I'm sending you the complete /etc/os-release data:

NAME="Arch Linux ARM"
PRETTY_NAME="Arch Linux ARM"
ID=archarm
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinuxarm.org/"
DOCUMENTATION_URL="https://archlinuxarm.org/wiki"
SUPPORT_URL="https://archlinuxarm.org/forum"
BUG_REPORT_URL="https://github.com/archlinuxarm/PKGBUILDs/issues"
LOGO=archlinux

What should the value the $key variable be? Best, Mike Josef Heinen @jheinen build.jl checks for ID or ID_LIKE. What does the arch command return on your PI? If it is "aarch64" then the problem can easily be fixed. mmtung @mmtung Hi. There is no arch command on the command line for Arch Linux, however the internal value is 'aarch64' defined in pacman.conf and makepkg.conf for this architecture (64 bit on RP 400). As I have checked, the value of$arch in Julia is 'aarch64' and $os takes the value 'Linux'. This falsely tries to download the file 'gr-0.55.0-Linux-aarch64.tar.gz.' All can be resolved by placing in build.js a replacement for: if [$arch='aarch64' and $os='Linux'] then replace$os='Linux' by \$os='Debian'. The Debian bundle for GR apparently runs on other distros of this architecture. Just send me your patched build.js, and I will check it on my installation. Best, Mike
Josef Heinen
@jheinen
I fixed the problem in GR.jl#master. Thanks for your help ...
mmtung
@mmtung
Great ! Thanks a lot !
Misha Mikhasenko
@mmikhasenko
thanks @jheinen
I am using gr() as a Plots backend. Can something similar be done there?
mathtex(0.1, 0.5, L"\langle \rangle, and \mathit{\Omega}")
Josef Heinen
@jheinen
Yes:
plot(title=L"\langle \rangle, and \mathit{\Omega}")
Misha Mikhasenko
@mmikhasenko
Omega is not italic. Italic in latex is made by either \mathit{\Omega}, or \varOmega
Mark Kittisopikul
@mkitti
Mmm... jheinen/GR.jl#392 . Looks like BinaryBuilder.jl's Qt5Base_jll may not play well with conda installed Qt