Graphics Issues in Juno/Atom

plotting

#1

I am just learning to use the IDE and Julia itself. I have managed to get Plots & PyPlot to work from a script. However, I can’t get a graph in a new window; gui(img) doesn’t seem to do anything. Also, I am having no luck at all with loading and viewing a .jpg file. In particular, no matter what packages I install and use, Julia keeps insisting that imgshow() doesn’t exist. Can somebody send me a script that actually opens and shows a .jpg file - preferably in a new window?


#2

Please provide a minimal reproducible example of what you have tried, and include the error message.


#3

Hi. Thanks for taking the time to help. This is using the REPL:

First I ran

Pkg.add(“Images”)
Pkg.add(“TestImages”)
Pkg.add(“ImageView”)
Pkg.update()

Then

img = testimage(“mandrill”)
imshow(img)

(I was trying to follow the instructions on the JuliaImages github page)

This is what Julia produced:

julia> using Images, TestImages, ImageView
WARNING: print_escaped is deprecated, use escape_string instead.
in depwarn(::String, ::Symbol) at .\deprecated.jl:64
in print_escaped(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Vararg{Any,N}) at .\deprecated.jl:30
in init() at C:\Users\Larry\AppData\Local\JuliaPro-0.5.0.4\pkgs-0.5.0.4\v0.5\Tk\src\tkwidget.jl:49
in include_from_node1(::String) at .\loading.jl:488 (repeats 2 times)
in eval(::Module, ::Any) at .\boot.jl:234
in require(::Symbol) at .\loading.jl:415
in include_from_node1(::String) at .\loading.jl:488
in eval(::Module, ::Any) at .\boot.jl:234
in require(::Symbol) at .\loading.jl:415
in eval(::Module, ::Any) at .\boot.jl:234
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
in macro expansion at .\REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68
while loading C:\Users\Larry\AppData\Local\JuliaPro-0.5.0.4\pkgs-0.5.0.4\v0.5\Tk\src\tkwidget.jl, in expression starting on line 455
WARNING: print_escaped is deprecated, use escape_string instead.
in depwarn(::String, ::Symbol) at .\deprecated.jl:64
in print_escaped(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Vararg{Any,N}) at .\deprecated.jl:30
in init() at C:\Users\Larry\AppData\Local\JuliaPro-0.5.0.4\pkgs-0.5.0.4\v0.5\Tk\src\tkwidget.jl:53
in include_from_node1(::String) at .\loading.jl:488 (repeats 2 times)
in eval(::Module, ::Any) at .\boot.jl:234
in require(::Symbol) at .\loading.jl:415
in include_from_node1(::String) at .\loading.jl:488
in eval(::Module, ::Any) at .\boot.jl:234
in require(::Symbol) at .\loading.jl:415
in eval(::Module, ::Any) at .\boot.jl:234
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
in macro expansion at .\REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68
while loading C:\Users\Larry\AppData\Local\JuliaPro-0.5.0.4\pkgs-0.5.0.4\v0.5\Tk\src\tkwidget.jl, in expression starting on line 455

julia> img = testimage(“mandrill”)
RGB Images.Image with:
data: 512×512 Array{ColorTypes.RGB{FixedPointNumbers.UFixed{UInt8,8}},2}
properties:
colorspace: sRGB
spatialorder: x y

julia> imshow(img)
ERROR: UndefVarError: imshow not defined

julia>

I am new at this, but there appears to be a problem in (at least) one of the Packages.

Thanks again for your help.

Larry Dworsky


#4

Please report the version of Julia are you using (versioninfo()) and which version of the Images package (Pkg.status("Images")). Have you done Pkg.update() recently?


#5

Julia version 0.8.0

Images version 0.5.14

and yes, I did a Pkg.update() just before I generated the error message that I sent to you.

And I don’t know if I mentioned, I’m running 64 bit Windows 10.

Thanks for the help

Larry Dworsky


#6

Julia 0.8.0 does not exist. It is best just to directly post the whole output of versioninfo().

That version of Images is now old. If you already did Pkg.update(), there may be some other package restricting Images to this version. One solution would be to delete the .julia directory (where packages are stored, which lives in your home directory) and reinstall the packages you need (e.g. by copying the REQUIRE file in .julia/v0.5 and putting it back once you have reinitialised the package directory).


#7

Sorry for the typo. It’s Julia vers 0.5.0.

I will try your suggestion. Thank you.


#8

My computer run Windows, my version is updated (0.6.2). I did the following:

In c:\Users\...\.julia\v0.6\Tk\src there is a source tkwidget.jl written in Julia. There do the follow replacements.

  1. Replace print_escaped (depreciated) by escape_string.
  2. Replace takebuf_string(b) (depreciated) by String(take!(b)) where b is any parameter.

After that Winston works like a charm.

Example:

using Winston
plot(rand(100))