InspectDR.jl icon indicating copy to clipboard operation
InspectDR.jl copied to clipboard

size attribute ignored

Open ufechner7 opened this issue 3 years ago • 3 comments
trafficstars

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 avatar Jun 05 '22 10:06 ufechner7

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 avatar Jun 05 '22 11:06 ufechner7

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.

ufechner7 avatar Jun 05 '22 21:06 ufechner7

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

ma-laforge avatar Jun 07 '22 01:06 ma-laforge