heliosdrm / GRUtils.jl

Tools for using the GR framework in Julia
Other
31 stars 6 forks source link

Figure handling #42

Open natgeo-wong opened 4 years ago

natgeo-wong commented 4 years ago

I just discovered GRUtils, and am liking the format and simplicity! Although, could I ask is it possible to suppress and prevent GRUtils (or just GR in general) from opening a window without explicitly calling for the window?

heliosdrm commented 4 years ago

Thanks for your nice words and for your question.

Since version 0.4.0 of GRUtils., the plot is not drawn unless you show it. So no window should be opened in any of these two situations:

  1. If the operation where you create the plot (e.g. plot(x,y), etc.) is not the last line of a code block.
  2. If the line that contains such an operation is ended in a colon (e.g. plot(x,y);).

The same applies to other functions that also return a figure, like title, legend, etc.

Or maybe I'm not understanding well the context of your issue?

natgeo-wong commented 4 years ago

I did try plot(x,y). However, it still opens a GKSTerm window, although this window is blank.

I am currently using macOS, julia 1.2. Heard that this might be a macOS issue?

It's nice that in for loops the window doesn't keep opening and closing. I tried using the GR() backend for Plots.jl in a for-loop and it kept flickering on the screen because it kept opening and clsoing and it was very distracting and eye-tiring.

heliosdrm commented 4 years ago

I've just tried:

julia> using GRUtils
julia> plot(rand(10));

... and nothing opens

I'm in Linux, so maybe it depends on the OS.

If enclosing it in a loop prevents the GKSTerm window to open, what happens if you do:

begin
   plot(x, y)
   nothing
end
natgeo-wong commented 4 years ago

Enclosing it in a loop causes a window to open, but nothing is plotted inside so it doesn't flicker. I can definitely live with that, as long as it is not distracting.

Thank you so much for your help and your fast response. GRUtils looks like a barebones plotting app without interaction, which is kind of what I want - something fast and simple and utilitarian.

heliosdrm commented 4 years ago

Thanks for the feedack. Anyway, I'd like to know what makes the blank window open in your project. Please confirm that it still opens if you if in a new session you do:

using GRUtils
plot(rand(10));

(Don't forget the colon after plot.)

And if it does, can you copy your version info and the status of your environment? E.g. copy the output of:

versioninfo()

and:

using Pkg
Pkg.status()
natgeo-wong commented 4 years ago

The blank window opens upon plot(rand(10));

julia> versioninfo()
Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.6.0)
  CPU: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = atom  -a
  JULIA_NUM_THREADS = 4

julia> Pkg.status()
\    Status `~/.julia/environments/v1.2/Project.toml`
^R
  [537997a7] AbstractPlotting v0.9.10 #master (https://github.com/JuliaPlots/AbstractPlotting.jl.git)
  [c52e3926] Atom v0.11.3
  [6e4b80f9] BenchmarkTools v0.4.3
  [ad839575] Blink v0.12.0
  [96028d6e] ClimateERA v0.1.0 [`~/.julia/dev/ClimateERA`]
  [47ceb0c8] ClimateEasy v0.1.1 [`~/.julia/dev/ClimateEasy`]
  [9be69d7f] ClimateGNSS v0.1.0 [`~/.julia/dev/ClimateGNSS`]
  [bbcbd578] ClimateIsca v0.1.0 [`~/.julia/dev/ClimateIsca`]
  [d91beb5f] ClimateSatellite v0.1.0 [`~/.julia/dev/ClimateSatellite`]
  [b0f682c7] ClimateShallowWater v0.1.0 [`~/Codes/JuliaClimate/ClimateShallowWater.jl`]
  [5ae59095] Colors v0.9.6
  [8f4d0f93] Conda v1.3.0
  [0c46a032] DifferentialEquations v6.8.0
  [31c24e10] Distributions v0.21.5
  [01fcc997] FTPClient v1.0.1
  [5789e2e9] FileIO v1.0.7
  [59287772] Formatting v0.4.1
  [f6369f11] ForwardDiff v0.10.5
  [e9467ef8] GLMakie v0.0.8 #master (https://github.com/JuliaPlots/GLMakie.jl.git)
  [5752ebe1] GMT v0.12.0
  [28b8d3ca] GR v0.42.0
  [0337cf30] GRUtils v0.4.2
  [c27321d9] Glob v1.2.0
  [f67ccb44] HDF5 v0.12.4
  [916415d5] Images v0.18.0
  [033835bb] JLD2 v0.1.3
  [e5e0dc1b] Juno v0.7.2
  [ee78f7c6] Makie v0.9.5 #master (https://github.com/JuliaPlots/Makie.jl.git)
  [30363a11] NetCDF v0.8.0
  [47be7bcc] ORCA v0.3.0
  [14b8a8f1] PkgTemplates v0.6.3
  [f0f68f2c] PlotlyJS v0.13.0
  [438e738f] PyCall v1.91.2
  [d330b81b] PyPlot v2.8.2
  [d2ef9438] Seaborn v0.4.1
  [2913bbd2] StatsBase v0.32.0
  [f3b207a7] StatsPlots v0.12.0
  [ade2ca70] Dates 
  [8bb1440f] DelimitedFiles 
  [37e2e46d] LinearAlgebra 
  [56ddb016] Logging 
  [44cfe95a] Pkg 
  [de0858da] Printf 
  [10745b16] Statistics 
heliosdrm commented 4 years ago

Thanks for the log. I can't see a particular reason why this is happening on your side.

natgeo-wong commented 4 years ago

Yeah it's probably a macOS issue, unfortunately. Thanks for looking into it!