From d468f5e130f9b00f1663c86760addec91793f9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 30 Mar 2020 17:43:07 +0200 Subject: [PATCH] [python] WIP matplotlib: avoid empty pixel line between bars and axis line --- python/port/mod/matplotlib/pyplot/plot_view.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/port/mod/matplotlib/pyplot/plot_view.cpp b/python/port/mod/matplotlib/pyplot/plot_view.cpp index 1c913f0a6..fdb4a9afb 100644 --- a/python/port/mod/matplotlib/pyplot/plot_view.cpp +++ b/python/port/mod/matplotlib/pyplot/plot_view.cpp @@ -57,8 +57,10 @@ void PlotView::traceRect(KDContext * ctx, KDRect r, PlotStore::Rect rect) const KDRect pixelRect( std::round(floatToPixel(Axis::Horizontal, rect.x())), std::round(floatToPixel(Axis::Vertical, rect.y())), - maxKDCoordinate(std::round(rect.width() / pixelWidth()), 1), // Rectangle should at least be visible - std::round(rect.height() / pixelHeight()) + // Use std::ceil instead of std::round to avoid empty pixel line between bars and horizontal axis line + // TODO: change stored rectangles to keep all summits? + maxKDCoordinate(std::ceil(rect.width() / pixelWidth()), 1), // Rectangle should at least be visible + std::ceil(rect.height() / pixelHeight()) ); ctx->fillRect(pixelRect, rect.color()); }