Skip to content

Enhancement: allow string or colormap to be passed to ImageItem directly #2067

@ntjess

Description

@ntjess

I find matplotlib's ability to accept a string cmap to be extremely convenient during plotting, i.e. plt.imshow(data, cmap='red'). It would be fantastic to enable the same functionality with pyqtgraph's pg.colormap, i.e. item.setImage(data, lut='viridis') or lut=pg.colormap.get('viridis').

The current workaround is lut=pg.colormap.get('viridis').getLookupTable(nPts=X). The trick with a str lut is how to determine X (i.e. during autolevels, should nPts always be set to image range?), what should happen if the image has negative values, and probably a host of options I'm not even considering. But it would be quite convenient 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions