@@ -124,7 +124,7 @@ PlotsBase.should_warn_on_unsupported(::GastonBackend) = false
124124
125125# create the window/figure for this backend.
126126function PlotsBase. _create_backend_figure(plt:: Plot{GastonBackend} )
127- return plt. o = Gaston. figure (nothing ; autolayout = false ) # for now all the figures will be kept
127+ return plt. o = Gaston. Figure (nothing ; autolayout = false ) # for now all the figures will be kept
128128end
129129
130130function PlotsBase. _before_layout_calcs(plt:: Plot{GastonBackend} )
@@ -135,7 +135,8 @@ function PlotsBase._before_layout_calcs(plt::Plot{GastonBackend})
135135 n, sps = gaston_get_subplots(0 , plt. subplots, plt. layout)
136136 end
137137
138- plt. o. multiplot = gaston_init_subplots!(plt, sps)
138+ r, c = gaston_init_subplots!(plt, sps)
139+ plt. o. multiplot = " layout $r ,$c columnsfirst"
139140
140141 # then add the series (curves in gaston)
141142 foreach(series -> gaston_add_series(plt, series), plt. series_list)
@@ -178,19 +179,14 @@ for (mime, term) in (
178179 @eval function PlotsBase. _show(io:: IO , :: MIME{Symbol($mime)} , plt:: Plot{GastonBackend} )
179180 term = String($ term)
180181 if plt. o ≢ nothing
181- tmpfile = tempname() * " .$term "
182- ret = Gaston. save(;
183- saveopts = gaston_saveopts(plt),
184- handle = plt. o. handle,
185- output = tmpfile,
186- term,
187- )
182+ filename = tempname() * " .$term "
183+ ret = Gaston. save(plt. o; filename, term = " $term $(gaston_saveopts(plt)) " )
188184 if ret ≡ nothing || ret
189- while ! isfile(tmpfile )
185+ while ! isfile(filename )
190186 end # avoid race condition with read in next line
191- write(io, read(tmpfile ))
187+ write(io, read(filename ))
192188 end
193- isfile(tmpfile ) && rm(tmpfile , force = true )
189+ isfile(filename ) && rm(filename , force = true )
194190 end
195191 return nothing
196192 end
@@ -264,8 +260,7 @@ function gaston_init_subplot!(
264260 obj = if sp ≡ nothing
265261 sp
266262 else
267- dims =
268- RecipesPipeline. is3d(sp) || sp[:projection] == " 3d" || needs_any_3d_axes(sp) ? 3 : 2
263+ dims = RecipesPipeline. is3d(sp) || sp[:projection] == " 3d" || needs_any_3d_axes(sp) ? 3 : 2
269264 any_label = false
270265 for series in series_list(sp)
271266 if dims == 2 && series[:seriestype] ∈ (:heatmap, :contour)
@@ -274,9 +269,10 @@ function gaston_init_subplot!(
274269 any_label |= should_add_to_legend(series)
275270 end
276271 axesconf = gaston_parse_axes_attrs(plt, sp, dims, any_label)
277- sp. o = Gaston. Plot(; dims, curves = [], axesconf)
272+ # sp.o = Gaston.Plot(; dims, curves = [], axesconf)
273+ sp. o = Gaston. Axis(axesconf, Gaston. Plot[], dims == 3 )
278274 end
279- push!(plt. o. subplots , obj)
275+ push!(plt. o, obj) # add new Axis ≡ subplot
280276 return nothing
281277end
282278
@@ -320,7 +316,7 @@ function gaston_multiplot_pos_size!(dat)
320316 sp. o ≡ nothing && continue
321317 # gnuplot screen coordinates: bottom left at 0,0 and top right at 1,1
322318 gx, gy = x, 1 - y - h
323- sp. o. axesconf = " set origin $gx , $gy ; set size $w , $h ; " * sp. o. axesconf
319+ sp. o. settings = " set origin $gx , $gy ; set size $w , $h ; " * sp. o. settings
324320 end
325321 end
326322 return nothing
@@ -331,13 +327,12 @@ function gaston_add_series(plt::Plot{GastonBackend}, series::Series)
331327 (gsp = sp. o) ≡ nothing && return
332328 x, y, z = series[:x], series[:y], series[:z]
333329 st = series[:seriestype]
334- curves = Gaston. Curve[]
335- if gsp. dims == 2 && z ≡ nothing
330+ if ! gsp. is3d && z ≡ nothing
336331 for (n, seg) in enumerate(series_segments(series, st; check = true ))
337332 i, rng = seg. attr_index, seg. range
338333 fr = _cycle(series[:fillrange], 1 : length(x[rng]))
339334 for sc in gaston_seriesconf!(sp, series, n == 1 , i)
340- push!(curves , Gaston. Curve (x[rng], y[rng], nothing , fr, sc))
335+ push!(gsp . plots , Gaston. Plot (x[rng], y[rng], fr, sc))
341336 end
342337 end
343338 else
@@ -367,15 +362,16 @@ function gaston_add_series(plt::Plot{GastonBackend}, series::Series)
367362 end
368363 end
369364 for sc in gaston_seriesconf!(sp, series, true , 1 )
370- push!(curves , Gaston. Curve (x, y, z, supp, sc))
365+ push!(gsp . plots , Gaston. Plot (x, y, z, supp, sc))
371366 end
372367 end
373368
374- for c in curves
375- append = length(gsp. curves) > 0
376- push!(gsp. curves, c)
377- Gaston. write_data(c, gsp. dims, gsp. datafile; append)
378- end
369+ # Gaston @v1
370+ # for c in curves
371+ # append = length(gsp.curves) > 0
372+ # push!(gsp.curves, c)
373+ # Gaston.write_data(c, gsp.dims, gsp.datafile; append)
374+ # end
379375 return nothing
380376end
381377
0 commit comments