Skip to content

Allow plotting multiple 2d images on the same figure? #449

@nvaytet

Description

@nvaytet

The following

import plopp as pp

a = pp.data.data2d()
b = a.copy()
b.coords['x'] = b.coords['x'] + sc.scalar(100., unit='m')

pp.plot({'a': a, 'b': b})

to show two images side by side on the same axes was intentionally disabled because in many cases the images would overlap.

Say you have a signal and a background, and the user wants to plot both:
doing `pp.plot({'sample': a, 'background': b}) where the two cover the same spatial range would result in a figure showing only the background, because it is drawn after the sample and the sample is hidden behind it.

The user's intention was probably to obtain two figures, instead of both images on the same axes.
This case is handled in 1d because you can often plot two curves on the same axes, with different color, and there isn't a curve hiding the other.

However, the first use case described at the start of this issue has come up more and more in real life examples, like plotting signal from multiple detector banks on the same axes.

Is the fear of having users confused by only seeing one image when sending two to the plot still outweighing the benefits of avoiding the workaround

to_plot = {'a': a, 'b': b}
as_nodes = {k: pp.Node(v) for k, v in to_plot.items()}
for k, v in as_nodes.items():
    v.name = k
pp.imagefigure(*as_nodes)

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