Skip to content

Commit 9943b08

Browse files
committed
UnicodePlots: Adjust total resolutions to make multiplots more consistent
1 parent bf2c8ed commit 9943b08

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

ext/GridVisualizeUnicodePlotsExt.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ function gridplot!(ctx, TP::Type{UnicodePlotsType}, ::Type{Val{1}}, grid)
229229
color = ctx[:color]
230230
end
231231

232-
# determine resolution (divided by 10, to reduce pixel count in the terminal)
232+
# determine resolution (divided by 5, to reduce pixel count in the terminal)
233233
layout = ctx[:layout]
234-
resolution = (Int(round(ctx[:size][1] / 10 / layout[2])), 5)
234+
resolution = (Int(round(ctx[:size][1] / 5 / layout[2])), 5)
235235

236236
# create UnicodePlots.Canvas
237237
legend_space = 5
@@ -322,7 +322,7 @@ function scalarplot!(
322322

323323
nfuncs = length(funcs)
324324
layout = ctx[:layout]
325-
resolution = @. Int(round(ctx[:size] ./ 10 ./ (layout[2], layout[1]))) # reduce pixel count in the terminal
325+
resolution = @. Int(round(ctx[:size] ./ 5 ./ (layout[2], layout[1] * 2))) # reduce pixel count in the terminal (size is then compatible to other plots)
326326
ylim = ctx[:limits]
327327

328328
if ylim[1] > ylim[2]
@@ -358,7 +358,7 @@ function scalarplot!(
358358

359359
func = funcs[1]
360360
layout = ctx[:layout]
361-
resolution = ctx[:size] ./ 10 ./ (layout[2], layout[1]) # reduce pixel count in the terminal
361+
resolution = ctx[:size] ./ 6 ./ (layout[2], layout[1]) # reduce pixel count in the terminal
362362
ylim = ctx[:limits]
363363
colormap = ctx[:colormap]
364364

@@ -403,6 +403,8 @@ function scalarplot!(
403403
yoffset = ey[1],
404404
title = ctx[:title],
405405
colormap = colormap,
406+
height = resolution[2],
407+
width = resolution[1]
406408
)
407409

408410
return reveal(ctx, TP)

0 commit comments

Comments
 (0)