From b3efcf9b681cb5d999299dba827f829d208931f6 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 12 Jun 2017 20:39:49 +0200 Subject: [PATCH 1/2] reduced colorbar size for z axis limits >= 1e7 --- src/backends/pyplot.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 3372da4d..72cf508c 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1220,7 +1220,8 @@ function _update_plot_object(plt::Plot{PyPlotBackend}) if haskey(sp.attr, :cbar_ax) cbw = sp.attr[:cbar_width] # this is the bounding box of just the colors of the colorbar (not labels) - cb_bbox = BoundingBox(right(sp.bbox)-cbw+1mm, top(sp.bbox)+2mm, _cbar_width-1mm, height(sp.bbox)-4mm) + has_toplabel = sp[:zaxis][:extrema].emax >= 1e7 + cb_bbox = BoundingBox(right(sp.bbox)-cbw+1mm, top(sp.bbox) + (has_toplabel ? 4mm : 2mm), _cbar_width-1mm, height(sp.bbox) - (has_toplabel ? 8mm : 4mm)) pcts = bbox_to_pcts(cb_bbox, figw, figh) sp.attr[:cbar_ax][:set_position](pcts) end From 5b6423ec6c80ad8260592330874dca00fc0a050e Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 12 Jun 2017 22:15:57 +0200 Subject: [PATCH 2/2] only change top corners of colorbar axes --- src/backends/pyplot.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 72cf508c..f7ca62ff 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1221,7 +1221,7 @@ function _update_plot_object(plt::Plot{PyPlotBackend}) cbw = sp.attr[:cbar_width] # this is the bounding box of just the colors of the colorbar (not labels) has_toplabel = sp[:zaxis][:extrema].emax >= 1e7 - cb_bbox = BoundingBox(right(sp.bbox)-cbw+1mm, top(sp.bbox) + (has_toplabel ? 4mm : 2mm), _cbar_width-1mm, height(sp.bbox) - (has_toplabel ? 8mm : 4mm)) + cb_bbox = BoundingBox(right(sp.bbox)-cbw+1mm, top(sp.bbox) + (has_toplabel ? 4mm : 2mm), _cbar_width-1mm, height(sp.bbox) - (has_toplabel ? 6mm : 4mm)) pcts = bbox_to_pcts(cb_bbox, figw, figh) sp.attr[:cbar_ax][:set_position](pcts) end