Skip to content

Violin plots fail with list inputs when data scale is logicle. #351

@JS3xton

Description

@JS3xton

Violin plots fail with list inputs when data scale is logicle in FlowCal v1.3.0.

E.g.,

>>> FlowCal.plot.violin(data=[1,3,2,4,3])

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\sexto\Downloads\taborlab_FlowCal\FlowCal\plot.py", line 1810, in violin
    t = _LogicleTransform(data=data, channel=channel)
  File "C:\Users\sexto\Downloads\taborlab_FlowCal\FlowCal\plot.py", line 271, in __init__
    if d.ndim > 1:
AttributeError: 'list' object has no attribute 'ndim'

This happens because plot._LogicleTransform checks for multidimensional data using the ndim attribute, which numpy arrays have but lists do not. (The plot violin functions use _LogicleTransform to calculate default bin edges and implicitly when they set the Logicle scale. In both cases, data are provided as is.)

A simple work-around is to pass a numpy array to the plot functions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions