Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gaston + DaemonMode: No output window shown #69

Closed
YggdrasiI opened this issue Sep 14, 2024 · 2 comments
Closed

Gaston + DaemonMode: No output window shown #69

YggdrasiI opened this issue Sep 14, 2024 · 2 comments

Comments

@YggdrasiI
Copy link

YggdrasiI commented Sep 14, 2024

Hello,

I'm struggling with the combination of Gaston (plotting via gnuplot) and DaemonMode. This minimal example will open a plotting window when called with julia, but does not produce any output/error message within DaemonMode

Did I miss something to setup or is this a Problem of Gaston?

Regards YggdrasiI

using Gaston
#Gaston.set(term="x11")

x = range(0, 2π; length=31)
plot(x, sin.(x))

Environment:
Manjaro 24.0.8, julia installed by juliaup

versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b362 (2024-08-27 14:19 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × AMD Ryzen 5 5600G with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

Server started by
julia --startup-file=no -e "using DaemonMode; serve()"

Client runs command with
julia --startup-file=no -e "using DaemonMode; runargs()" "$@"

@dmolina
Copy link
Owner

dmolina commented Sep 16, 2024

Dear @YggdrasiI,

Thank you for your interest in my package. Have you tested directly? I have tested, and I have discovered:

  • In the REPL, it is working nicely, but you have to uncomment the second line. The reason is that in command line you require it, maybe in a notebook is not needed.
  • Running it with julia ... it does not work, because the program quit before the visualization can be shown. There is not any pause. Thus, try to save the figure to check it.

By the way, I recommend you julia plots: https://docs.juliaplots.org/latest/ or Makie (https://docs.makie.org/stable/), in conjunction with https://aog.makie.org/stable/. In my opinion, they are better options.

@YggdrasiI
Copy link
Author

YggdrasiI commented Sep 16, 2024

Good evening dmolina,

thanks, you've pointed me in the right direction. I made a mistake and it also not open the plotting window if the script is running with julia {scriptname} on my computer(s).

So it turns out it was the rookie mistake caused by Julia's plotting technique.
For completeness and other beginners, like me: Outside of the REPL the drawing of a figure needs an explicit display(...) call. Otherwise the output will be omited. A working example will be following code. This will also work in DaemonMode as expected.
In my case the setting of terminal doen't matter. It will also draw with the default value (qt).

using Gaston
Gaston.set(term="x11")

x = range(0, 2π; length=31)
fig = plot(x, sin.(x))
display(fig)

Your suggestion to use Makie is generally correct. In my case, however, I come from there and had problems using GLMakie on all computers and was looking for a variant that runs everywhere without code changes.

Regards YggdrasiI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants