[python/matplotlib] Add grid control

This commit is contained in:
Romain Goyet
2020-03-11 17:53:19 -04:00
committed by Émilie Feral
parent a3b1b51f75
commit a062c570d5
7 changed files with 34 additions and 13 deletions

View File

@@ -4,12 +4,16 @@ namespace Matplotlib {
void PlotView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(rect, KDColorWhite);
if (m_store->grid()) {
if (m_store->gridRequested()) {
drawGrid(ctx, rect);
}
drawAxes(ctx, rect);
drawLabelsAndGraduations(ctx, rect, Axis::Vertical, true);
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, true);
if (m_store->axesRequested()) {
drawAxes(ctx, rect);
drawLabelsAndGraduations(ctx, rect, Axis::Vertical, true);
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, true);
}
for (PlotStore::Dot dot : m_store->dots()) {
drawDot(ctx, rect, dot.x(), dot.y(), dot.color());
@@ -32,7 +36,6 @@ void PlotView::drawRect(KDContext * ctx, KDRect rect) const {
segment.color()
);
}
}
}