Skip to content

35 minimal heatmap code raising an error#37

Merged
thomas-saigre merged 8 commits into
mainfrom
35-minimal-heatmap-code-raising-an-error
Apr 12, 2026
Merged

35 minimal heatmap code raising an error#37
thomas-saigre merged 8 commits into
mainfrom
35-minimal-heatmap-code-raising-an-error

Conversation

@thomas-saigre

@thomas-saigre thomas-saigre commented Apr 9, 2026

Copy link
Copy Markdown
Owner
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? (either manual or automated one, cf the documentation)
  • Have you successfully run the tests with your changes locally?
  • Have you written documentation, even succinct, of your contribution for the online website?

@thomas-saigre thomas-saigre self-assigned this Apr 9, 2026
@thomas-saigre thomas-saigre added bug Something isn't working enhancement New feature or request labels Apr 9, 2026
@thomas-saigre thomas-saigre linked an issue Apr 9, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Apr 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.14286% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/tikzplotly/_save.py 75.00% 1 Missing ⚠️
src/tikzplotly/_trace_utils.py 96.66% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/tikzplotly/_color.py 99.74% <100.00%> (+0.16%) ⬆️
src/tikzplotly/_data_container.py 96.93% <100.00%> (ø)
src/tikzplotly/_heatmap.py 95.00% <100.00%> (+0.06%) ⬆️
src/tikzplotly/_histogram.py 100.00% <100.00%> (ø)
src/tikzplotly/_polar.py 91.15% <100.00%> (ø)
src/tikzplotly/_scatter.py 88.70% <100.00%> (-0.83%) ⬇️
src/tikzplotly/_scatter3d.py 88.88% <100.00%> (+4.83%) ⬆️
src/tikzplotly/_utils.py 97.05% <100.00%> (+3.81%) ⬆️
src/tikzplotly/_save.py 94.07% <75.00%> (ø)
src/tikzplotly/_trace_utils.py 96.66% <96.66%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses multiple open issues around heatmap export errors, color handling, and warning management in tests for tikzplotly, while also refactoring shared marker-option logic.

Changes:

  • Fix heatmap image output directory creation when img_name has no dirname (e.g., default "heatmap.png").
  • Improve/adjust color conversion behavior (notably rgba(...) parsing and unsupported color inputs) and add dedicated color tests.
  • Standardize warning handling in pytest tests and refactor scatter/scatter3d marker option code into a shared utility.

Reviewed changes

Copilot reviewed 38 out of 41 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tox.ini Switch tox deps to requirements.txt and add plotly_get_chrome step before pytest.
requirements.txt Add pytest-related packages to shared requirements list.
pyproject.toml Add pytest filterwarnings configuration.
.gitignore Ignore MkDocs site/** output; minor formatting cleanup.
docs/develop/tests.md Fix typo in documentation text.
docs/develop/contributing.md Improve wording, update admonition type, document pytest warning ignores.
src/tikzplotly/_heatmap.py Prevent os.makedirs('') by using '.' when dirname is empty.
src/tikzplotly/_color.py Change unsupported color handling and enhance rgba(...) parsing (optional alpha).
src/tikzplotly/_utils.py Simplify sanitize_char logic for spaces/non-ascii/non-printable chars.
src/tikzplotly/_trace_utils.py New shared helper for scatter-like marker option assembly.
src/tikzplotly/_scatter.py Use shared marker helper for 2D scatter marker options.
src/tikzplotly/_scatter3d.py Use shared marker helper for 3D scatter marker options.
src/tikzplotly/_histogram.py Factor histnorm handling into treat_histnorm() and add empty-histogram behavior.
src/tikzplotly/_data_container.py Adjust add_data3d() return value (currently inconsistent between branches).
src/tikzplotly/_polar.py Update DataContainer import path casing.
src/tikzplotly/_save.py Update DataContainer import path casing; adjust 3D data add call and string sanitization.
tests/test_colors.py New tests covering multiple color input formats and warning cases.
tests/test_colors/test_colors_transparent_background_reference.tex New/updated reference for transparent background handling.
tests/test_colors/test_colors_rgba-with-opacity_reference.tex New reference output for rgba color input.
tests/test_colors/test_colors_rgba-without-opacity_reference.tex New reference output for rgba color input without alpha.
tests/test_colors/test_colors_rgb_reference.tex New reference output for rgb color input.
tests/test_colors/test_colors_hex_reference.tex New reference output for hex color input.
tests/test_colors/test_colors_named-color_reference.tex New reference output for named color input.
tests/test_colors/test_colors_colors-dict-hit_reference.tex New reference output for plotly named color-dict hit.
tests/test_colors/test_colors_numpy-array_reference.tex New reference output for numpy-array color input (unsupported).
tests/test_colors/test_colors_non-string_reference.tex New reference output for non-string color input (unsupported).
tests/test_colors/test_colors_none_reference.tex New reference output for None color input.
tests/test_specific.py Update tests to assert warnings; add empty-histogram test case.
tests/test_specific/test_specific_empty_histogram_reference.tex New reference output for empty histogram case.
tests/test_scatter.py Update tests to assert/conditionally expect warnings.
tests/test_scatter3d.py Update tests to assert/conditionally expect warnings for unsupported color-from-data.
tests/test_scatter3d/test_scatter3d_2_markers_reference.tex Update reference output reflecting marker option/color changes.
tests/test_scatter3d/test_scatter3d_2_markers+lines_reference.tex Update reference output reflecting marker option/color changes.
tests/test_histograms.py Update tests to assert/conditionally expect warnings around histnorm/histfunc.
tests/test_polar.py Update test to expect warning for unsupported barpolar.
tests/test_markers.py Update test to conditionally expect warning for unsupported dotted markers.
tests/test_markers/test_markers_1_reference.tex Update reference output (marker option ordering/format).
tests/test_markers/test_markers_2_reference.tex Update reference output (marker option ordering/format).
tests/test_markers/test_markers_3_reference.tex Update reference output (marker option ordering/format).
tests/test_markers/test_markers_angle_reference.tex Update reference output (marker option ordering/format).
tests/test_heatmap.py Update tests to expect warnings and adjust date generation; rename empty-trace helper.
Comments suppressed due to low confidence (1)

src/tikzplotly/_data_container.py:189

  • DataContainer.add_data3d() now returns a single value when creating new data (return data_obj.name) but still returns a 2-tuple in the cache-hit path (return data.name, data.z_name). This makes the return type inconsistent and can break callers (e.g., get_tikz_code() now assumes a string). Update the cache-hit branch to return the same type (and update the docstring accordingly).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tikzplotly/_color.py
Comment thread tests/test_specific.py
Comment thread tox.ini Outdated
Comment thread src/tikzplotly/_scatter.py Outdated
Comment thread docs/develop/contributing.md Outdated
@thomas-saigre thomas-saigre merged commit 2d72ad5 into main Apr 12, 2026
12 checks passed
@thomas-saigre thomas-saigre deleted the 35-minimal-heatmap-code-raising-an-error branch April 12, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle warning detection in tests with pytest Minimal heatmap code raising an error [Bugs] color not correctly handled

2 participants