From e38dc2328a14419f2c113a8e15f0bc7ff82e5104 Mon Sep 17 00:00:00 2001 From: Xen0Xys Date: Thu, 1 Aug 2024 16:28:09 +0200 Subject: [PATCH] :memo: Add export_view_as_image example in notebook 11 --- ...Extracting_information_from_the_view.ipynb | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/examples/11_Extracting_information_from_the_view.ipynb b/examples/11_Extracting_information_from_the_view.ipynb index 7efaadab..9f0a2397 100644 --- a/examples/11_Extracting_information_from_the_view.ipynb +++ b/examples/11_Extracting_information_from_the_view.ipynb @@ -66,7 +66,7 @@ "id": "998def1f-3963-405b-8be2-6d4ef4012634", "metadata": {}, "source": [ - "If you edit the view either by modifiing the widget through its interface, or programmatically: " + "If you edit the view either by modifiing the widget through its interface, or programmatically:" ] }, { @@ -106,7 +106,7 @@ "id": "f5add3a2-be30-488e-86df-426338b98f5d", "metadata": {}, "source": [ - "If you try to recover the value in the **same cell**, you'll get a `WidgetCommunicationError` error. This is because the calculation of the WCS is done by Aladin Lite *between* cell executions. \n", + "If you try to recover the value in the **same cell**, you'll get a `WidgetCommunicationError` error. This is because the calculation of the WCS is done by Aladin Lite *between* cell executions.\n", "\n", "## Getting the field of view\n", "\n", @@ -204,7 +204,7 @@ "metadata": {}, "source": [ "## Getting the view as a fits file\n", - "The following method allow you to retrieve the current view as a fits file. If a `path` is given as a second argument, the fits file will be saved." + "The following method allow you to retrieve the current view as a fits file." ] }, { @@ -247,13 +247,28 @@ "plt.subplot(projection=wcs)\n", "plt.imshow(fits[0].data, cmap=\"binary_r\", norm=\"asinh\", vmin=0.001)" ] + }, + { + "cell_type": "markdown", + "id": "c64190a2757b707", + "metadata": {}, + "source": [ + "## Saving the view as an image file\n", + "The following method allow you to save the current view as an image file. The first argument is the path to the file, the second is the format (png, jpg, pdf, svg, eps), and the third is a boolean to indicate if you want to include the Aladin Lite logo in the image." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "85f40dc5e6af3ae1", + "metadata": {}, + "outputs": [], + "source": [ + "aladin.export_view_as_image(\"./image.png\", \"png\", True)" + ] } ], - "metadata": { - "nbsphinx": { - "execute": "never" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 5 }