Skip to content

Conversation

@cvanelteren
Copy link
Collaborator

This PR will attempt to parse the data inputs as a dtype=object if the input has different dimensions as was the case in #317. This would allow for more flexible parsing in violin and boxplots.

@cvanelteren cvanelteren requested a review from Copilot August 10, 2025 16:20
Copy link
Contributor

Copilot AI left a comment

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 adds support for handling non-homogeneous arrays in violin and box plots by implementing graceful fallback to dtype=object when numpy.atleast_1d() fails. This addresses issue #317 where arrays with different dimensions couldn't be processed.

  • Modified _to_numpy_array to catch exceptions and fallback to object dtype for non-homogeneous data
  • Added comprehensive test coverage for various data type scenarios
  • Added specific test for inhomogeneous violin plots

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ultraplot/internals/inputs.py Implements try-except block to handle non-homogeneous arrays with object dtype fallback
ultraplot/tests/test_inputs.py Adds parametrized tests for _to_numpy_array function with various data types
ultraplot/tests/test_plot.py Adds test for inhomogeneous violin plot functionality

cvanelteren and others added 3 commits August 10, 2025 18:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@cvanelteren cvanelteren requested a review from beckermr August 10, 2025 16:48
@cvanelteren cvanelteren merged commit 88591ac into Ultraplot:main Aug 11, 2025
24 checks passed
@cvanelteren cvanelteren deleted the handle-non-homogeneous-arrays branch August 12, 2025 08:41
cvanelteren added a commit that referenced this pull request Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants