3030 AnnotatedPolygon ,
3131 AnnotatedRectangle ,
3232 AnnotatedSegment ,
33+ AnnotatedXRangeSelection ,
34+ AnnotatedYRangeSelection ,
3335)
3436from plotpy .styles import AnnotationParam
3537
@@ -138,6 +140,8 @@ def __annotated_shape(
138140 transform_matrix ,
139141 readonly ,
140142 private ,
143+ section : str = "plot" ,
144+ option : str = "shape/drag" ,
141145 ):
142146 param = self .__get_annotationparam (
143147 title = title ,
@@ -155,7 +159,7 @@ def __annotated_shape(
155159 shape = shapeclass (points , annotationparam = param )
156160 else :
157161 shape = shapeclass (* points , annotationparam = param )
158- shape .set_style ("plot" , "shape/drag" )
162+ shape .set_style (section , option )
159163 return shape
160164
161165 def annotated_rectangle (
@@ -385,6 +389,108 @@ def annotated_segment(
385389 private ,
386390 )
387391
392+ def annotated_xrange (
393+ self ,
394+ x0 : float ,
395+ x1 : float ,
396+ title : str | None = None ,
397+ subtitle : str | None = None ,
398+ show_label : bool | None = None ,
399+ show_computations : bool | None = None ,
400+ show_subtitle : bool | None = None ,
401+ format : str | None = None ,
402+ uncertainty : float | None = None ,
403+ transform_matrix : np .ndarray | None = None ,
404+ readonly : bool | None = None ,
405+ private : bool | None = None ,
406+ ) -> AnnotatedXRangeSelection :
407+ """Make an annotated x-range selection `plot item`
408+
409+ Args:
410+ x0: lower x coordinate
411+ x1: upper x coordinate
412+ title: label name. Default is None
413+ subtitle: label subtitle. Default is None
414+ show_label: show label. Default is None
415+ show_computations: show computations. Default is None
416+ show_subtitle: show subtitle. Default is None
417+ format: string formatting. Default is None
418+ uncertainty: measurement relative uncertainty. Default is None
419+ transform_matrix: transform matrix. Default is None
420+ readonly: readonly. Default is None
421+ private: private. Default is None
422+
423+ Returns:
424+ :py:class:`.AnnotatedXRangeSelection` object
425+ """
426+ return self .__annotated_shape (
427+ AnnotatedXRangeSelection ,
428+ (x0 , x1 ),
429+ title ,
430+ subtitle ,
431+ show_label ,
432+ show_computations ,
433+ show_subtitle ,
434+ format ,
435+ uncertainty ,
436+ transform_matrix ,
437+ readonly ,
438+ private ,
439+ section = "plot" ,
440+ option = "range" ,
441+ )
442+
443+ def annotated_yrange (
444+ self ,
445+ y0 : float ,
446+ y1 : float ,
447+ title : str | None = None ,
448+ subtitle : str | None = None ,
449+ show_label : bool | None = None ,
450+ show_computations : bool | None = None ,
451+ show_subtitle : bool | None = None ,
452+ format : str | None = None ,
453+ uncertainty : float | None = None ,
454+ transform_matrix : np .ndarray | None = None ,
455+ readonly : bool | None = None ,
456+ private : bool | None = None ,
457+ ) -> AnnotatedYRangeSelection :
458+ """Make an annotated y-range selection `plot item`
459+
460+ Args:
461+ y0: lower y coordinate
462+ y1: upper y coordinate
463+ title: label name. Default is None
464+ subtitle: label subtitle. Default is None
465+ show_label: show label. Default is None
466+ show_computations: show computations. Default is None
467+ show_subtitle: show subtitle. Default is None
468+ format: string formatting. Default is None
469+ uncertainty: measurement relative uncertainty. Default is None
470+ transform_matrix: transform matrix. Default is None
471+ readonly: readonly. Default is None
472+ private: private. Default is None
473+
474+ Returns:
475+ :py:class:`.AnnotatedYRangeSelection` object
476+ """
477+ return self .__annotated_shape (
478+ AnnotatedYRangeSelection ,
479+ (y0 , y1 ),
480+ title ,
481+ subtitle ,
482+ show_label ,
483+ show_computations ,
484+ show_subtitle ,
485+ format ,
486+ uncertainty ,
487+ transform_matrix ,
488+ readonly ,
489+ private ,
490+ section = "plot" ,
491+ option = "range" ,
492+ )
493+
388494 def annotated_polygon (
389495 self ,
390496 points : np .ndarray ,
0 commit comments