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

GR plots does not appear in notebook #15

Closed
Roger-luo opened this issue Jun 16, 2018 · 6 comments
Closed

GR plots does not appear in notebook #15

Roger-luo opened this issue Jun 16, 2018 · 6 comments

Comments

@Roger-luo
Copy link

Roger-luo commented Jun 16, 2018

My script contains a command that uses GR to plot. But when I set execute=true for notebook, it does not appear in the notebook (appears like the script is executed). Will this be possible to fix?

using GR
# ## Training target
function gaussian_pdf(n, μ, σ)
    x = collect(1:1<<n)
    pl = @. 1 / sqrt(2pi * σ^2) * exp(-(x - μ)^2 / (2 * σ^2))
    pl / sum(pl)
end

const n = 6
const maxiter = 20
pg = gaussian_pdf(n, 2^5-0.5, 2^4)
fig = plot(0:1<<n-1, pg)
@fredrikekre
Copy link
Owner

This is a GR issue. GR does not show the plot as part of a show call.

@Roger-luo
Copy link
Author

Roger-luo commented Jun 16, 2018

Oh, I see. I'll open an issue in GR's repo then. Thank you.

@fredrikekre
Copy link
Owner

I think you can use GR with Plots.jl though, since Plots does not display until show is called.

@jheinen
Copy link

jheinen commented Aug 18, 2018

Works fine on all platforms (in Jupyter notebook, nteract and Atom).

screen shot 2018-08-18 at 15 47 54

Which version() are you using (0.32.3?). Please try:

Pkg.update()
ENV["GRDIR"]=""
Pkg.build("GR")

@Roger-luo
Copy link
Author

@jheinen

julia> versioninfo()
Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin17.7.0)
  CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libimf
  LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
(v1.0) pkg> status
    Status `~/.julia/environments/v1.0/Project.toml`
  [6e4b80f9] BenchmarkTools v0.4.0
  [e30172f5] Documenter v0.19.5
  [5789e2e9] FileIO v1.0.1
  [28b8d3ca] GR v0.32.3+ [`~/.julia/dev/GR`]
  [7073ff75] IJulia v1.9.3
  [c601a237] Interact v0.8.0+ #master (https://github.com/JuliaGizmos/Interact.jl.git)
  [033835bb] JLD2 v0.1.0
  [98b081ad] Literate v1.0.0
  [9b87118b] PackageCompiler v0.4.0
  [91a5bcdd] Plots v0.19.2
  [d330b81b] PyPlot v2.6.0
  [65c24e16] QuAlgorithmZoo v0.1.0 [`~/.julia/environments/v1.0/../../../Documents/Workshop/QuAlgorithmZoo.jl`]
  [1fd47b50] QuadGK v2.0.1
  [295af30f] Revise v0.6.9
  [276daf66] SpecialFunctions v0.7.0
  [1bc31baa] Yao v0.2.0 #8e117de (https://github.com/QuantumBFS/Yao.jl.git)

actually I even tried the master branch...

It works fine in the notebook, but it does not work when you let Literate.jl to execute after converting the script to notebooks.

@Roger-luo
Copy link
Author

See #27, I mean the notebook function's execute keyword does not seem to work...

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

3 participants