-
Notifications
You must be signed in to change notification settings - Fork 80
Plot embedded in Canvas #429
Comments
GR.jl has an example https://github.com/jheinen/GR.jl/blob/master/examples/gtk_ex.jl |
I tried the GR example in Atom, I get errors. When I compile the same code in terminal it just run well. If I change the plot type to just plot instead of hexbin, I got errors as well. Let me try a little more. I'll share all the information and error messages. Thanks |
I just change the code in gtk_ex.jl and run it on the Julia repl and everything was perfect, but in Atom I got: Starting Julia... FATAL ERROR: Gtk state corrupted by error thrown in a callback: julia> , ::Function, ::String, ::Bool) at .\error.jl:134 |
It crashes because it fails to load a file, last time I used Juno I also had paths problems (I couldn't include a file even though it existed). To prevent Gtk crashing completely you can add a You can also check Immerse.jl, it has interactive figures with a figure manager. It uses Gadfly though, so it's a bit slow to warm up. |
Hey everybody. Solution is here; When using Atom, disable the plot pane in the JuliaClient settings. Thats all. Kelvyn |
@jonathanBieler Can I push! the plot created with immerse (with its functionality - figure manager) into a Gtk Canvas?? Thanks. |
Immerse has a Figure type that already contains a Canvas, you can just push it into a container. That's how I do it, I overwrite the figure method and push the Figure into a Notebook : https://github.com/jonathanBieler/GtkIDE.jl/blob/master/src/PlotWindow.jl#L133 |
Hi @jonathanBieler, This code runs without errors, but my windows does not show the plot:
|
@Kelvyn88 Here's a working example, like I said you need to overwrite the using Immerse, Gtk.ShortNames
mainWin = Window("")
global const grid = Grid()
grid[1,1] = Label("Nice plot")
push!(mainWin, grid)
Gtk.showall(mainWin)
function Immerse.figure(;name::AbstractString="Figure $(Immerse.nextfig(Immerse._display))",
width::Integer=400,
height::Integer=400)
i = Immerse.nextfig(Immerse._display)
f = Immerse.Figure()
signal_connect(Immerse.on_figure_destroy, f, "destroy", Nothing, (), false, (i, Immerse._display))
grid[1,2] = f
Gtk.showall(grid)
Immerse.initialize_toolbar_callbacks(f)
Immerse.addfig(Immerse._display, i, f)
i
end
p = Immerse.plot(x=rand(10), y=rand(10)) |
I got it. Thanks!! |
Hi everybody!
I want to know how to draw a plot created with PyPlot or GR in Canvas. I´m working in a chemical simulation project and I need to show the plot with the results next to others elements or Gtk (buttons, menus, checkboxes)
Any suggestion would be greatly considered.
Kelvyn
The text was updated successfully, but these errors were encountered: