[python] WIP matplotlib: avoid empty pixel line between bars and axis

line
This commit is contained in:
Émilie Feral
2020-03-30 17:43:07 +02:00
parent 84bc46ca8c
commit d468f5e130

View File

@@ -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());
}