py4cytoscape.annotations.add_annotation_bounded_text

add_annotation_bounded_text(text=None, x_pos=None, y_pos=None, font_size=None, font_family=None, font_style=None, color=None, angle=None, type=None, custom_shape=None, fill_color=None, opacity=None, border_thickness=None, border_color=None, border_opacity=None, height=None, width=None, name=None, canvas=None, z_order=None, network=None, base_url='http://127.0.0.1:1234/v1')[source]

Add Bounded Text Annotation

Adds a bounded text annotation to a Cytoscape network view. The object will also be added to the Annotation Panel in the GUI.

Parameters
  • text (str) – The text to be displayed

  • x_pos (int) – X position in pixels from left; default is center of current view

  • y_pos (int) – Y position in pixels from top; default is center of current view

  • font_size (int) – Numeric value; default is 12

  • font_family (str) – Font family; default is Arial

  • font_style (str) – Font style; default is none

  • color (str) – hexadecimal color; default is #000000 (black)

  • angle (float) – Angle of text orientation; default is 0.0 (horizontal)

  • type (str) – The type of the shape, default is RECTANGLE. Seee get_node_shapes() for valid options

  • custom_shape (str) – If a custom shape, this is the text of the shape

  • fill_color (str) – hexadecimal color; default is #000000 (black)

  • opacity (int) – Opacity of fill color. Must be an integer between 0 and 100; default is 100

  • border_thickness (int) – non-negative integer

  • border_color (str) – hexadecimal color; default is #000000 (black)

  • border_opacity (int) – Integer between 0 and 100; default is 100

  • height (int) – Height of bounding shape; default is based on text height

  • width (int) –

  • name (str) – Name of annotation object; default is “Text”

  • canvas (str) – Canvas to display annotation, i.e., foreground (default) or background

  • z_order (int) – Arrangement order specified by number (larger values are in front of smaller values); default is 0

  • network (SUID or str or None) – Name or SUID of the network. Default is the “current” network active in Cytoscape.

  • base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://localhost:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

A named list of annotation properties, including UUID

Return type

dict

Raises
  • CyError – if network name doesn’t exist or error in parameter value

  • requests.exceptions.HTTPError – if can’t connect to Cytoscape or Cytoscape returns an error

Examples

>>> add_annotation_bounded_text(text='ann1')
{'edgeThickness': '1.0', 'canvas': 'foreground', 'fillOpacity': '100.0', 'color': '#000000', 'rotation': '0.0', 'type': 'org.cytoscape.view.presentation.annotations.BoundedTextAnnotation', 'fontStyle': 'plain', 'uuid': '250660b5-f371-48a6-9942-bdacacf1ec8a', 'shapeType': 'RECTANGLE', 'edgeColor': '#000000', 'fontFamily': 'Arial', 'edgeOpacity': '100.0', 'name': 'ann1', 'x': '2449.9784057344455', 'width': '34.6953125', 'y': '1882.9888145962157', 'z': '0', 'fontSize': '12', 'text': 'ann1', 'height': '21.798828125'}
>>> add_annotation_bounded_text(text='ann3', x_pos=100, y_pos=200, font_size=25, font_family='Courier New', font_style='bold', color='#F0F0F0', angle=45, type='ELLIPSE', custom_shape=None, fill_color='#A0A0A0', opacity=50, border_thickness=2, border_color='#0F0F0F', border_opacity=75, height=30, width=31, name='ann3 name', canvas='background')
{'edgeThickness': '2.0', 'canvas': 'background', 'fillOpacity': '50.0', 'color': '#F0F0F0', 'rotation': '45.0', 'type': 'org.cytoscape.view.presentation.annotations.BoundedTextAnnotation', 'fontStyle': 'bold', 'uuid': 'fbf6c4e1-7b28-4274-9ce0-a0b7f5618a51', 'fillColor': '#A0A0A0', 'shapeType': 'ELLIPSE', 'edgeColor': '#0F0F0F', 'fontFamily': 'Courier New', 'edgeOpacity': '75.0', 'name': 'ann1 name', 'x': '100.0', 'width': '31.0', 'y': '200.0', 'z': '0', 'fontSize': '25', 'text': 'ann1', 'height': '30.0'}