summaryrefslogtreecommitdiff
path: root/src/silx/gui/plot/tools/test/testProfile.py
blob: 61b95a64333946757b8e06defefa18ef951334d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
# /*##########################################################################
#
# Copyright (c) 2018-2023 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
__authors__ = ["T. Vincent"]
__license__ = "MIT"
__date__ = "28/06/2018"


import contextlib
import numpy
import logging

from silx.gui import qt

from silx.gui.utils.testutils import TestCaseQt
from silx.utils.testutils import ParametricTestCase
from silx.gui.plot import PlotWindow, Plot1D, Plot2D, Profile
from silx.gui.plot.StackView import StackView
from silx.gui.plot.tools.profile import rois
from silx.gui.plot.tools.profile import editors
from silx.gui.plot.items import roi as roi_items
from silx.gui.plot.tools.profile import manager
from silx.gui import plot as silx_plot

_logger = logging.getLogger(__name__)


class TestRois(TestCaseQt):
    def test_init(self):
        """Check that the constructor is not called twice"""
        roi = rois.ProfileImageVerticalLineROI()
        if qt.BINDING == "PyQt5":
            # the profile ROI + the shape
            self.assertEqual(roi.receivers(roi.sigRegionChanged), 2)


class TestInteractions(TestCaseQt):
    @contextlib.contextmanager
    def defaultPlot(self):
        try:
            widget = silx_plot.PlotWidget()
            widget.show()
            self.qWaitForWindowExposed(widget)
            yield widget
        finally:
            widget.close()
            widget = None
            self.qWait()

    @contextlib.contextmanager
    def imagePlot(self):
        try:
            widget = silx_plot.Plot2D()
            image = numpy.arange(10 * 10).reshape(10, -1)
            widget.addImage(image)
            widget.show()
            self.qWaitForWindowExposed(widget)
            yield widget
        finally:
            widget.close()
            widget = None
            self.qWait()

    @contextlib.contextmanager
    def scatterPlot(self):
        try:
            widget = silx_plot.ScatterView()

            nbX, nbY = 7, 5
            yy = numpy.atleast_2d(numpy.ones(nbY)).T
            xx = numpy.atleast_2d(numpy.ones(nbX))
            positionX = numpy.linspace(10, 50, nbX) * yy
            positionX = positionX.reshape(nbX * nbY)
            positionY = numpy.atleast_2d(numpy.linspace(20, 60, nbY)).T * xx
            positionY = positionY.reshape(nbX * nbY)
            values = numpy.arange(nbX * nbY)

            widget.setData(positionX, positionY, values)
            widget.resetZoom()
            widget.show()
            self.qWaitForWindowExposed(widget)
            yield widget.getPlotWidget()
        finally:
            widget.close()
            widget = None
            self.qWait()

    @contextlib.contextmanager
    def stackPlot(self):
        try:
            widget = silx_plot.StackView()
            image = numpy.arange(10 * 10).reshape(10, -1)
            cube = numpy.array([image, image, image])
            widget.setStack(cube)
            widget.resetZoom()
            widget.show()
            self.qWaitForWindowExposed(widget)
            yield widget.getPlotWidget()
        finally:
            widget.close()
            widget = None
            self.qWait()

    def waitPendingOperations(self, proflie):
        for _ in range(10):
            if not proflie.hasPendingOperations():
                return
            self.qWait(100)
        _logger.error("The profile manager still have pending operations")

    def genericRoiTest(self, plot, roiClass):
        profileManager = manager.ProfileManager(plot, plot)
        profileManager.setItemType(image=True, scatter=True)

        try:
            action = profileManager.createProfileAction(roiClass, plot)
            action.triggered[bool].emit(True)
            widget = plot.getWidgetHandle()

            # Do the mouse interaction
            pos1 = widget.width() * 0.4, widget.height() * 0.4
            self.mouseMove(widget, pos=pos1)
            self.mouseClick(widget, qt.Qt.LeftButton, pos=pos1)

            if issubclass(roiClass, roi_items.LineROI):
                pos2 = widget.width() * 0.6, widget.height() * 0.6
                self.mouseMove(widget, pos=pos2)
                self.mouseClick(widget, qt.Qt.LeftButton, pos=pos2)

            self.waitPendingOperations(profileManager)

            # Test that something was computed
            if issubclass(roiClass, rois._ProfileCrossROI):
                self.assertEqual(profileManager._computedProfiles, 2)
            elif issubclass(roiClass, roi_items.LineROI):
                self.assertGreaterEqual(profileManager._computedProfiles, 1)
            else:
                self.assertEqual(profileManager._computedProfiles, 1)

            # Test the created ROIs
            profileRois = profileManager.getRoiManager().getRois()
            if issubclass(roiClass, rois._ProfileCrossROI):
                self.assertEqual(len(profileRois), 3)
            else:
                self.assertEqual(len(profileRois), 1)
            # The first one should be the expected one
            roi = profileRois[0]

            # Test that something was displayed
            if issubclass(roiClass, rois._ProfileCrossROI):
                profiles = roi._getLines()
                window = profiles[0].getProfileWindow()
                self.assertIsNotNone(window)
                window = profiles[1].getProfileWindow()
                self.assertIsNotNone(window)
            else:
                window = roi.getProfileWindow()
                self.assertIsNotNone(window)
        finally:
            profileManager.clearProfile()

    def testImageActions(self):
        roiClasses = [
            rois.ProfileImageHorizontalLineROI,
            rois.ProfileImageVerticalLineROI,
            rois.ProfileImageLineROI,
            rois.ProfileImageCrossROI,
        ]
        with self.imagePlot() as plot:
            for roiClass in roiClasses:
                with self.subTest(roiClass=roiClass):
                    self.genericRoiTest(plot, roiClass)

    def testScatterActions(self):
        roiClasses = [
            rois.ProfileScatterHorizontalLineROI,
            rois.ProfileScatterVerticalLineROI,
            rois.ProfileScatterLineROI,
            rois.ProfileScatterCrossROI,
            rois.ProfileScatterHorizontalSliceROI,
            rois.ProfileScatterVerticalSliceROI,
            rois.ProfileScatterCrossSliceROI,
        ]
        with self.scatterPlot() as plot:
            for roiClass in roiClasses:
                with self.subTest(roiClass=roiClass):
                    self.genericRoiTest(plot, roiClass)

    def testStackActions(self):
        roiClasses = [
            rois.ProfileImageStackHorizontalLineROI,
            rois.ProfileImageStackVerticalLineROI,
            rois.ProfileImageStackLineROI,
            rois.ProfileImageStackCrossROI,
        ]
        with self.stackPlot() as plot:
            for roiClass in roiClasses:
                with self.subTest(roiClass=roiClass):
                    self.genericRoiTest(plot, roiClass)

    def genericEditorTest(self, plot, roi, editor):
        if isinstance(editor, editors._NoProfileRoiEditor):
            pass
        elif isinstance(editor, editors._DefaultImageStackProfileRoiEditor):
            # GUI to ROI
            editor._lineWidth.setValue(2)
            self.assertEqual(roi.getProfileLineWidth(), 2)
            editor._methodsButton.setMethod("sum")
            self.assertEqual(roi.getProfileMethod(), "sum")
            editor._profileDim.setDimension(1)
            self.assertEqual(roi.getProfileType(), "1D")
            # ROI to GUI
            roi.setProfileLineWidth(3)
            self.assertEqual(editor._lineWidth.value(), 3)
            roi.setProfileMethod("mean")
            self.assertEqual(editor._methodsButton.getMethod(), "mean")
            roi.setProfileType("2D")
            self.assertEqual(editor._profileDim.getDimension(), 2)
        elif isinstance(editor, editors._DefaultImageProfileRoiEditor):
            # GUI to ROI
            editor._lineWidth.setValue(2)
            self.assertEqual(roi.getProfileLineWidth(), 2)
            editor._methodsButton.setMethod("sum")
            self.assertEqual(roi.getProfileMethod(), "sum")
            # ROI to GUI
            roi.setProfileLineWidth(3)
            self.assertEqual(editor._lineWidth.value(), 3)
            roi.setProfileMethod("mean")
            self.assertEqual(editor._methodsButton.getMethod(), "mean")
        elif isinstance(editor, editors._DefaultScatterProfileRoiEditor):
            # GUI to ROI
            editor._nPoints.setValue(100)
            self.assertEqual(roi.getNPoints(), 100)
            # ROI to GUI
            roi.setNPoints(200)
            self.assertEqual(editor._nPoints.value(), 200)
        else:
            assert False

    def testEditors(self):
        roiClasses = [
            (rois.ProfileImageHorizontalLineROI, editors._DefaultImageProfileRoiEditor),
            (rois.ProfileImageVerticalLineROI, editors._DefaultImageProfileRoiEditor),
            (rois.ProfileImageLineROI, editors._DefaultImageProfileRoiEditor),
            (rois.ProfileImageCrossROI, editors._DefaultImageProfileRoiEditor),
            (
                rois.ProfileScatterHorizontalLineROI,
                editors._DefaultScatterProfileRoiEditor,
            ),
            (
                rois.ProfileScatterVerticalLineROI,
                editors._DefaultScatterProfileRoiEditor,
            ),
            (rois.ProfileScatterLineROI, editors._DefaultScatterProfileRoiEditor),
            (rois.ProfileScatterCrossROI, editors._DefaultScatterProfileRoiEditor),
            (rois.ProfileScatterHorizontalSliceROI, editors._NoProfileRoiEditor),
            (rois.ProfileScatterVerticalSliceROI, editors._NoProfileRoiEditor),
            (rois.ProfileScatterCrossSliceROI, editors._NoProfileRoiEditor),
            (
                rois.ProfileImageStackHorizontalLineROI,
                editors._DefaultImageStackProfileRoiEditor,
            ),
            (
                rois.ProfileImageStackVerticalLineROI,
                editors._DefaultImageStackProfileRoiEditor,
            ),
            (rois.ProfileImageStackLineROI, editors._DefaultImageStackProfileRoiEditor),
            (
                rois.ProfileImageStackCrossROI,
                editors._DefaultImageStackProfileRoiEditor,
            ),
        ]
        with self.defaultPlot() as plot:
            profileManager = manager.ProfileManager(plot, plot)
            editorAction = profileManager.createEditorAction(parent=plot)
            for roiClass, editorClass in roiClasses:
                with self.subTest(roiClass=roiClass):
                    roi = roiClass()
                    roi._setProfileManager(profileManager)
                    try:
                        # Force widget creation
                        menu = qt.QMenu(plot)
                        menu.addAction(editorAction)
                        widgets = editorAction.createdWidgets()
                        self.assertGreater(len(widgets), 0)

                        editorAction.setProfileRoi(roi)
                        editorWidget = editorAction._getEditor(widgets[0])
                        self.assertIsInstance(editorWidget, editorClass)
                        self.genericEditorTest(plot, roi, editorWidget)
                    finally:
                        editorAction.setProfileRoi(None)
                        menu.deleteLater()
                        menu = None
                        self.qapp.processEvents()


class TestProfileToolBar(TestCaseQt, ParametricTestCase):
    """Tests for ProfileToolBar widget."""

    def setUp(self):
        super(TestProfileToolBar, self).setUp()
        self.plot = PlotWindow()
        self.toolBar = Profile.ProfileToolBar(plot=self.plot)
        self.plot.addToolBar(self.toolBar)

        self.plot.show()
        self.qWaitForWindowExposed(self.plot)

        self.mouseMove(self.plot)  # Move to center
        self.qapp.processEvents()

    def tearDown(self):
        self.qapp.processEvents()
        profileManager = self.toolBar.getProfileManager()
        profileManager.clearProfile()
        profileManager = None
        self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
        self.plot.close()
        del self.plot
        del self.toolBar

        super(TestProfileToolBar, self).tearDown()

    def testAlignedProfile(self):
        """Test horizontal and vertical profile, without and with image"""
        # Use Plot backend widget to submit mouse events
        widget = self.plot.getWidgetHandle()
        for method in ("sum", "mean"):
            with self.subTest(method=method):
                # 2 positions to use for mouse events
                pos1 = widget.width() * 0.4, widget.height() * 0.4
                pos2 = widget.width() * 0.6, widget.height() * 0.6

                for action in (self.toolBar.hLineAction, self.toolBar.vLineAction):
                    with self.subTest(mode=action.text()):
                        # Trigger tool button for mode
                        action.trigger()
                        # Without image
                        self.mouseMove(widget, pos=pos1)
                        self.mouseClick(widget, qt.Qt.LeftButton, pos=pos1)

                        # with image
                        self.plot.addImage(numpy.arange(100 * 100).reshape(100, -1))
                        self.mousePress(widget, qt.Qt.LeftButton, pos=pos1)
                        self.mouseMove(widget, pos=pos2)
                        self.mouseRelease(widget, qt.Qt.LeftButton, pos=pos2)

                        self.mouseMove(widget)
                        self.mouseClick(widget, qt.Qt.LeftButton)

                        manager = self.toolBar.getProfileManager()
                        for _ in range(20):
                            self.qWait(200)
                            if not manager.hasPendingOperations():
                                break

    def testDiagonalProfile(self):
        """Test diagonal profile, without and with image"""
        # Use Plot backend widget to submit mouse events
        widget = self.plot.getWidgetHandle()

        self.plot.addImage(numpy.arange(100 * 100).reshape(100, -1))

        for method in ("sum", "mean"):
            with self.subTest(method=method):
                # 2 positions to use for mouse events
                pos1 = widget.width() * 0.4, widget.height() * 0.4
                pos2 = widget.width() * 0.6, widget.height() * 0.6

                # Trigger tool button for diagonal profile mode
                self.toolBar.lineAction.trigger()

                # draw profile line
                widget.setFocus(qt.Qt.OtherFocusReason)
                self.mouseMove(widget, pos=pos1)
                self.qWait(100)
                self.mousePress(widget, qt.Qt.LeftButton, pos=pos1)
                self.qWait(100)
                self.mouseMove(widget, pos=pos2)
                self.qWait(100)
                self.mouseRelease(widget, qt.Qt.LeftButton, pos=pos2)
                self.qWait(100)

                manager = self.toolBar.getProfileManager()

                for _ in range(20):
                    self.qWait(200)
                    if not manager.hasPendingOperations():
                        break

                roi = manager.getCurrentRoi()
                self.assertIsNotNone(roi)
                roi.setProfileLineWidth(3)
                roi.setProfileMethod(method)

                for _ in range(20):
                    self.qWait(200)
                    if not manager.hasPendingOperations():
                        break

                curveItem = (
                    roi.getProfileWindow().getCurrentPlotWidget().getAllCurves()[0]
                )
                if method == "sum":
                    self.assertTrue(curveItem.getData()[1].max() > 10000)
                elif method == "mean":
                    self.assertTrue(curveItem.getData()[1].max() < 10000)

                # Remove the ROI so the profile window is also removed
                roiManager = manager.getRoiManager()
                roiManager.removeRoi(roi)
                self.qWait(100)


class TestProfile3DToolBar(TestCaseQt):
    """Tests for Profile3DToolBar widget."""

    def setUp(self):
        super(TestProfile3DToolBar, self).setUp()
        self.plot = StackView()
        self.plot.show()
        self.qWaitForWindowExposed(self.plot)

        self.plot.setStack(
            numpy.array(
                [
                    [[0, 1, 2], [3, 4, 5]],
                    [[6, 7, 8], [9, 10, 11]],
                    [[12, 13, 14], [15, 16, 17]],
                ]
            )
        )

    def tearDown(self):
        profileManager = self.plot.getProfileToolbar().getProfileManager()
        profileManager.clearProfile()
        profileManager = None
        self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
        self.plot.close()
        self.plot = None

        super(TestProfile3DToolBar, self).tearDown()

    def testMethodProfile2D(self):
        """Test that the profile can have a different method if we want to
        compute then in 1D or in 2D"""

        toolBar = self.plot.getProfileToolbar()

        toolBar.vLineAction.trigger()
        plot2D = self.plot.getPlotWidget().getWidgetHandle()
        pos1 = plot2D.width() * 0.5, plot2D.height() * 0.5
        self.mouseClick(plot2D, qt.Qt.LeftButton, pos=pos1)

        manager = toolBar.getProfileManager()
        roi = manager.getCurrentRoi()
        roi.setProfileMethod("mean")
        roi.setProfileType("2D")
        roi.setProfileLineWidth(3)

        for _ in range(20):
            self.qWait(200)
            if not manager.hasPendingOperations():
                break

        # check 2D 'mean' profile
        profilePlot = roi.getProfileWindow().getCurrentPlotWidget()
        data = profilePlot.getAllImages()[0].getData()
        expected = numpy.array([[1, 4], [7, 10], [13, 16]])
        numpy.testing.assert_almost_equal(data, expected)

    def testMethodSumLine(self):
        """Simple interaction test to make sure the sum is correctly computed"""
        toolBar = self.plot.getProfileToolbar()

        toolBar.lineAction.trigger()
        plot2D = self.plot.getPlotWidget().getWidgetHandle()
        pos1 = plot2D.width() * 0.5, plot2D.height() * 0.2
        pos2 = plot2D.width() * 0.5, plot2D.height() * 0.8

        self.mouseMove(plot2D, pos=pos1)
        self.mousePress(plot2D, qt.Qt.LeftButton, pos=pos1)
        self.mouseMove(plot2D, pos=pos2)
        self.mouseRelease(plot2D, qt.Qt.LeftButton, pos=pos2)

        manager = toolBar.getProfileManager()
        roi = manager.getCurrentRoi()
        roi.setProfileMethod("sum")
        roi.setProfileType("2D")
        roi.setProfileLineWidth(3)

        for _ in range(20):
            self.qWait(200)
            if not manager.hasPendingOperations():
                break

        # check 2D 'sum' profile
        profilePlot = roi.getProfileWindow().getCurrentPlotWidget()
        data = profilePlot.getAllImages()[0].getData()
        expected = numpy.array([[3, 12], [21, 30], [39, 48]])
        numpy.testing.assert_almost_equal(data, expected)


class TestGetProfilePlot(TestCaseQt):
    def setUp(self):
        self.plot = None
        super(TestGetProfilePlot, self).setUp()

    def tearDown(self):
        if self.plot is not None:
            manager = self.plot.getProfileToolbar().getProfileManager()
            manager.clearProfile()
            manager = None
            self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
            self.plot.close()
            self.plot = None

        super(TestGetProfilePlot, self).tearDown()

    def testProfile1D(self):
        self.plot = Plot2D()
        self.plot.show()
        self.qWaitForWindowExposed(self.plot)
        self.plot.addImage([[0, 1], [2, 3]])

        toolBar = self.plot.getProfileToolbar()

        manager = toolBar.getProfileManager()
        roiManager = manager.getRoiManager()

        roi = rois.ProfileImageHorizontalLineROI()
        roi.setPosition(0.5)
        roiManager.addRoi(roi)
        roiManager.setCurrentRoi(roi)

        for _ in range(20):
            self.qWait(200)
            if not manager.hasPendingOperations():
                break

        profileWindow = roi.getProfileWindow()
        self.assertIsInstance(roi.getProfileWindow(), qt.QMainWindow)
        self.assertIsInstance(profileWindow.getCurrentPlotWidget(), Plot1D)

    def testProfile2D(self):
        """Test that the profile plot associated to a stack view is either a
        Plot1D or a plot 2D instance."""
        self.plot = StackView()
        self.plot.show()
        self.qWaitForWindowExposed(self.plot)

        self.plot.setStack(numpy.array([[[0, 1], [2, 3]], [[4, 5], [6, 7]]]))

        toolBar = self.plot.getProfileToolbar()

        manager = toolBar.getProfileManager()
        roiManager = manager.getRoiManager()

        roi = rois.ProfileImageStackHorizontalLineROI()
        roi.setPosition(0.5)
        roi.setProfileType("2D")
        roiManager.addRoi(roi)
        roiManager.setCurrentRoi(roi)

        for _ in range(20):
            self.qWait(200)
            if not manager.hasPendingOperations():
                break

        profileWindow = roi.getProfileWindow()
        self.assertIsInstance(roi.getProfileWindow(), qt.QMainWindow)
        self.assertIsInstance(profileWindow.getCurrentPlotWidget(), Plot2D)

        roi.setProfileType("1D")

        for _ in range(20):
            self.qWait(200)
            if not manager.hasPendingOperations():
                break

        profileWindow = roi.getProfileWindow()
        self.assertIsInstance(roi.getProfileWindow(), qt.QMainWindow)
        self.assertIsInstance(profileWindow.getCurrentPlotWidget(), Plot1D)