Delta e image plot#1922
Conversation
|
|
Overall Grade |
Security Reliability Complexity Hygiene Coverage |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Jun 15, 2026 5:37p.m. | Review ↗ | |
| Code coverage | Jun 15, 2026 5:37p.m. | Review ↗ |
Code Coverage Summary
| Language | Line Coverage (New Code) | Line Coverage (Overall) |
|---|---|---|
| Aggregate | 100% [✓ above threshold] |
100% |
| Python | 100% [✓ above threshold] |
100% |
➟ Additional coverage metrics may have been reported. See full coverage report ↗
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
Pull request overview
Adds new QC visualizations to support the emerging color quality tooling in pcv.qc, including a Delta E per-image bar plot, and updates tests + documentation/navigation to reflect the move of color QC plots into the QC module.
Changes:
- Add
pcv.qc.plot_deltaE()(Altair) for per-chip Delta E bar plots (Macbeth + AstroBotany). - Add
pcv.qc.color_chip_comparison()(Altair) andpcv.qc.color_correction_plot()(matplotlib) and expose them viaplantcv.plantcv.qc. - Update tests and MkDocs navigation for QC plot pages; remove
color_correction_plotexport fromplantcv.visualize.
Reviewed changes
Copilot reviewed 12 out of 18 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/plantcv/qc/test_plot_deltaE.py | Adds tests asserting plot_deltaE returns an Altair layered chart. |
| tests/plantcv/qc/test_color_correction_scatter.py | Updates import to pull color_correction_plot from plantcv.plantcv.qc. |
| tests/plantcv/qc/test_color_chip_comparison.py | Adds a test asserting color_chip_comparison returns an Altair vconcat chart. |
| plantcv/plantcv/visualize/init.py | Stops exporting color_correction_plot from plantcv.visualize. |
| plantcv/plantcv/qc/plot_delta_e.py | Implements Delta E bar plot with category coloring + reference lines + chip swatches. |
| plantcv/plantcv/qc/color_correction_scatter.py | Adds QC scatter plot implementation (matplotlib). |
| plantcv/plantcv/qc/color_chip_comparison.py | Adds greenness-rank comparison visualization (Altair). |
| plantcv/plantcv/qc/init.py | Exports new QC plotting functions from the module. |
| mkdocs.yml | Adds QC docs pages to nav; removes visualize scatter page from nav. |
| docs/updating.md | Adds an updating entry for the color chip comparison plot (needs correction to qc). |
| docs/qc_plot_delta_e.md | Adds documentation page for the new Delta E plot (contains a truncated comment). |
| docs/qc_color_correction_scatter.md | Updates docs page to reflect the QC module path and images. |
| docs/qc_color_chip_comparison.md | Adds documentation page for the new chip comparison plot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| swatch_chip_nos = (std_mat[:, 0] / 10).astype(int) | ||
| swatch_hex = [ | ||
| f"{int(r * 255):02X}{int(g * 255):02X}{int(b * 255):02X}" | ||
| for r, g, b in std_mat[:, 1:4] | ||
| ] |
| # Visualize a scatter plot representation of color correction | ||
|
|
||
| import pandas as pd | ||
| import altair as alt | ||
|
|
||
|
|
||
| def color_chip_comparison(std_matrix, *args): | ||
| """ | ||
| Plot 4 panels showing the difference in observed vs expected colors and optionally | ||
| the calibrated colors in a color card. | ||
| The color of each dot is given by the RGB value either of the original image, known color card, or corrected image. | ||
|
|
| df["std_B"] = stddf["std_B"] | ||
| df_list.append(df) | ||
| # rbind all dataframes from list | ||
| fulldf = pd.concat(*[df_list], ignore_index=True) |
| method="first", ascending=False | ||
| ) | ||
| # label chips 1 to 24 | ||
| fulldf["chip"] = fulldf["chip"] / 10 |
| #### plantcv.visualize.color_chip_comparison | ||
|
|
||
| * pre v4.10: NA | ||
| * post v4.10: plot = plantcv.visualize.color_chip_comparison**(*std_matrix, \*args*) |
| - "Quality Control Tools": | ||
| - 'Color Correction Scatter Plot': qc_color_correction_scatter.md | ||
| - 'Color Chip Comparison Plot': qc_color_chip_comparison.md | ||
| - "Exposure": qc_exposure.md | ||
| - "Quick Color Check": quick_color_check.md | ||
| - 'Read Image': read_image.md |
| # Calculate Delta E values for each chip relative to the standard color matrix | ||
| # Note this is | ||
| de_matrix = deltaE(rgb_img=img, color_chip_size="classic") |
Describe your changes
Adds a function to make a barplot of delta E values to the qc module.
Type of update
This is a new feature
Associated issues
Part of #1910
Additional context
This builds off of PRs #1905, #1920, and #1779
For the reviewer
See this page for instructions on how to review the pull request.
plantcv/mkdocs.ymlupdating.md