JuliaPlots / InspectDR.jl

Fast, interactive Julia/GTK+ plots (+Smith charts +Gtk widget +Cairo-only images)
MIT License
68 stars 9 forks source link

size attribute ignored #30

Open ufechner7 opened 2 years ago

ufechner7 commented 2 years ago

I am not able to change the size of the plot window. Example code:

using Plots; inspectdr()

x=0:0.05:100
y1=sin.(x)

p1 = plot(x,y1, size=(1200,700), legend=false)
display(p1);

The size is always small, about 640x480. How can I increase the initial size of the plot window?

ufechner7 commented 2 years ago

I also tried, as explained in the README, but it doesn't work:

DEFAULTS_INSPECTDR = Dict(
    :rendersvg => true,

    #Special options available @ initialization:
    :droppoints => :always, #One of: {:always, :never, :noglyph, :hasline}
    :notation_x => :SI,   #Change x-axis notation
    :notation_y => :SI,   #Change y-axis notation
    :fontname => "Sans",  #Change default font family
    :fontscale => 1.2,    #Scale up/down font default sizes

    #Basic plot options:
    :halloc_data => 1000,
    :valloc_data =>  700,
)
using Plots; inspectdr()
ufechner7 commented 2 years ago

Solution from discourse:

using Plots; inspectdr()

x=0:0.05:100
y1=sin.(x)

p1 = plot(x,y1, legend=false)
pIDR=display(p1); #Display with InspectDR and keep plot object
resize!(pIDR.wnd, 1200, 700) #Resize GTK window directly

Well, this is more like a work-around. Other plotting backends of Plots.jl use the size attribute also for as window size, so I think for consistency it would be good if InspectDR would behave in the same way.

ma-laforge commented 2 years ago

That does sound like a very good argument - even if I wasn't initially looking at it that way.

I admit, I'm not 100% certain on how to do this... because the size() attribute in Plots.jl code appears to control subplot size (not the final plot size).

I don't see myself looking into this in the near future, but feel free to take a look that the code in Plots.jl: -->https://github.com/JuliaPlots/Plots.jl src/backends/inspectdr.jl

I typically use one of the more complete/actively developed backends as an example (like GR): src/backends/gr.jl