Repository navigation
Conversation
matplotlib smooths images by default ("antialiased") when they are shown
at less than about 3 pixels per cell, and it averages the data values
before colouring them. For lithology ids that creates formations that
are not there: between the basement (0) and a young formation (5), the
averages 1-4 are drawn as thin lines or dots of the formations in
between. It shows up in flat models drawn to scale, e.g. the Weisweiler
case study (110 x 95 cells, 28 km wide, 3.8 km deep: one pixel per cell
in z), where the 2D section had red WalhornFM dots inside WilhelmineFM
and thin lines of other formations along the boundaries.
interpolation="nearest" for the categorical images:
- plot_structural_model_2D: lithology
- plot_fault_model_2D: fault domain map
- StructuralFrame.plot_age_mask_section: age mask (True/False)
Not changed: the scalar field section (continuous values) and the
simulation contour plots.
Tests: a section where the basement borders the youngest formation,
drawn at under 3 pixels per cell, may only contain those two colours
(fails without the fix); the three images use nearest.
Co-Authored-By: Claude Opus 5.5
Member
Author
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
The categorical images of the 2D plots are drawn with
interpolation="nearest":plot_structural_model_2D: lithologyplot_fault_model_2D: fault domain mapStructuralFrame.plot_age_mask_section: age mask (True/False)Why
matplotlib smooths images by default (
antialiased) when they are shown at less than about 3 pixels per cell, and it averages the data values before colouring them. For lithology ids this draws formations that aren't there: between the basement (id 0) and a young formation (id 5), the averages 1–4 appear as thin lines or dots of the formations in between.It shows up in flat models drawn to scale. In the Weisweiler case study (110 × 95 cells in the section, 28 km wide and 3.8 km deep, so about one pixel per cell in z), the 2D section showed red dots of one formation inside another and thin lines of other formations along the boundaries. A pixel comparison of that section: 815 pixels showed the wrong formation and about 1,400 a blended colour that belongs to no formation; with
nearestboth disappear. The fault domain map has the same problem with domain ids, and the age mask got grey edges.Not changed: the scalar field section (continuous values) and the simulation contour plots (
contourf), where smoothing doesn't invent categories.Until this is merged, the same effect can be had in a script with
plt.rcParams["image.interpolation"] = "nearest".Tests
nearest.