py4cytoscape.notebook.notebook_export_show_image¶
-
notebook_export_show_image
(filename='image', type='PNG', resolution=None, units=None, height=None, width=None, zoom=None, sandbox_name=None, network=None, base_url='http://127.0.0.1:1234/v1', *, overwrite_file=True)[source]¶ Show network view in notebook output.
Export a network view to an image file, then upload the file to the notebook file system and display the image.
- Parameters
filename (str) – Full path or path relative to current working directory, in addition to the name of the file. File is used to save image of network view so it can be transferred to the notebook file system and displayed. Extension is automatically added based on the
type
argument.type (str) – Type of image to export, e.g., PNG (default), JPEG, PDF, SVG, PS (PostScript).
resolution (int) – The resolution of the exported image, in DPI. Valid only for bitmap formats, when the selected width and height ‘units’ is inches. The possible values are: 72 (default), 100, 150, 300, 600.
units (str) – The possible values are: pixels (default), inches.
height (float) – The height of the exported image. Valid only for bitmap formats, such as PNG and JPEG.
width (float) – The width of the exported image. Valid only for bitmap formats, such as PNG and JPEG.
zoom (float) – The zoom value to proportionally scale the image. The default value is 100.0. Valid only for bitmap formats, such as PNG and JPEG
sandbox_name (str) – Name of sandbox containing file. None means “the current sandbox”.
network (str or SUID or None) – Name or SUID of the network or view. Default is the “current” network active in Cytoscape. If a network view SUID is provided, then it is validated and used.
base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.
overwrite_file (bool) – False allows Cytoscape show a message box before overwriting the file if the file already exists; True allows Cytoscape to overwrite it without asking
- Returns
iPython.display.Image class instance
- Return type
object
- Raises
CyError – if network doesn’t exist or the file cannot be written
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> notebook_export_show_image() >>> notebook_export_show_image('myfile.png', overwrite_file=False) >>> notebook_export_show_image('imagex', type='JPG')