-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvistools.py
More file actions
55 lines (48 loc) · 1.43 KB
/
vistools.py
File metadata and controls
55 lines (48 loc) · 1.43 KB
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
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the BSD 3-Clause
# (see plotpy/LICENSE for details)
"""Visualisation tools for plotpy tests"""
from __future__ import annotations
from typing import TYPE_CHECKING
from plotpy.builder import make
if TYPE_CHECKING:
from plotpy.items import BaseImageItem, CurveItem
from plotpy.plot import PlotDialog
def show_items(
items: list[CurveItem | BaseImageItem],
plot_type: str = "auto",
wintitle: str = "Plot items",
title: str = "Title",
xlabel: str = "X",
ylabel: str = "Y",
auto_tools: bool = True,
lock_aspect_ratio: bool | None = None,
curve_antialiasing: bool | None = None,
show_itemlist: bool = True,
show_contrast: bool = False,
winsize: tuple[int, int] | None = None,
) -> PlotDialog:
"""Show plot items in a dialog box"""
winsize = (640, 480) if winsize is None else winsize
win = make.dialog(
edit=False,
toolbar=True,
wintitle=wintitle,
title=title,
xlabel=xlabel,
ylabel=ylabel,
type=plot_type,
auto_tools=auto_tools,
lock_aspect_ratio=lock_aspect_ratio,
curve_antialiasing=curve_antialiasing,
show_itemlist=show_itemlist,
show_contrast=show_contrast,
size=winsize,
)
plot = win.manager.get_plot()
for item in items:
plot.add_item(item)
plot.set_items_readonly(False)
win.show()
return win