22
22
"""
23
23
24
24
try :
25
- from typing import Union
25
+ from typing import Union , Tuple
26
26
from typing_extensions import Literal
27
27
except ImportError :
28
28
pass
29
29
30
30
import displayio
31
+ import terminalio
31
32
from bitmaptools import draw_line
32
33
from vectorio import Circle
34
+ from adafruit_display_text import bitmap_label
33
35
from ulab import numpy as np
34
36
35
37
@@ -142,6 +144,7 @@ def axs_params(self, axstype: Literal["box", "cartesian", "line"] = "box") -> No
142
144
Setting up axs visibility
143
145
144
146
:param axstype: argument with the kind of axs you selected
147
+
145
148
:return: None
146
149
147
150
"""
@@ -231,6 +234,7 @@ def transform(
231
234
:param int|float newrangemin: minimum of the new range
232
235
:param int|float newrangemax: maximum of the new range
233
236
:param int|float value: value to be converted
237
+
234
238
:return int|float: converted value
235
239
236
240
"""
@@ -246,6 +250,7 @@ def _draw_ticks(self, x: int, y: int) -> None:
246
250
247
251
:param int x: x coord
248
252
:param int y: y coord
253
+
249
254
:return:None
250
255
251
256
"""
@@ -338,6 +343,7 @@ def tick_params(
338
343
:param int tickheight: tick height in pixels
339
344
:param int tickcolor: tick color in hex
340
345
:param bool tickgrid: defines if the grid is to be shown
346
+
341
347
:return: None
342
348
343
349
"""
@@ -350,7 +356,9 @@ def tick_params(
350
356
def _draw_gridx (self , ticks_data : list [int ]) -> None :
351
357
"""
352
358
Draws the plot grid
359
+
353
360
:param list[int] ticks_data: ticks data information
361
+
354
362
:return: None
355
363
356
364
"""
@@ -370,7 +378,9 @@ def _draw_gridx(self, ticks_data: list[int]) -> None:
370
378
def _draw_gridy (self , ticks_data : list [int ]) -> None :
371
379
"""
372
380
Draws plot grid in the y axs
381
+
373
382
:param list[int] ticks_data: ticks data information
383
+
374
384
:return: None
375
385
376
386
"""
@@ -396,3 +406,21 @@ def update_plot(self) -> None:
396
406
"""
397
407
398
408
self ._drawbox ()
409
+
410
+ def show_text (
411
+ self , text : str , x : int , y : int , anchorpoint : Tuple = (0.5 , 0.0 )
412
+ ) -> None :
413
+ """
414
+
415
+ Show desired text in the scree
416
+ :param str text: text to be displayed
417
+ :param int x: x coordinate
418
+ :param int y: y coordinate
419
+ :param Tuple anchorpoint: Display_text anchor point. Defaults to (0.5, 0.0)
420
+ :return: None
421
+ """
422
+
423
+ text_toplot = bitmap_label .Label (terminalio .FONT , text = text , x = x , y = y )
424
+ text_toplot .anchor_point = anchorpoint
425
+ text_toplot .anchored_position = (x , y )
426
+ self .append (text_toplot )
0 commit comments