From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: Show the figure created by matplotlib in Emacs' frame. Date: Thu, 16 Sep 2021 20:45:00 +0200 Message-ID: <87zgsctkqd.fsf@fastmail.fm> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12451"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.3; emacs 27.2.50 Cc: help-gnu-emacs@gnu.org To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 16 20:58:15 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQwaL-0002zw-BI for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 16 Sep 2021 20:58:15 +0200 Original-Received: from localhost ([::1]:60372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQwaJ-0006N5-UU for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 16 Sep 2021 14:58:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQwWQ-0004xW-Th for help-gnu-emacs@gnu.org; Thu, 16 Sep 2021 14:54:15 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:45239) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQwWP-0006Yb-21 for help-gnu-emacs@gnu.org; Thu, 16 Sep 2021 14:54:10 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 8CF615C01FC; Thu, 16 Sep 2021 14:54:06 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 16 Sep 2021 14:54:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= references:from:to:cc:subject:date:in-reply-to:message-id :mime-version:content-type; s=fm1; bh=RB/muMAUIpD0VQ5P29QeDrb3c6 ga94SzvUiFyutJqY8=; b=fzQbaYzOX1gzx212ErudODliBPc4tuVAdAsMwUd2dU 6deQgWS6OoKA5VjF0oapT1VRIDzkcA6b3/J0S1aXB5oZ/H+xUN5FMAlSuAC6oSbF JK7+1yXIPjF5DXDsPQBR7HJkvEG2dlEehSCoKcFaf8dytXQg+Lsy6OQsBv+Z0ATV ECj6qWTeGvEi6bSnxjlCp3Hjo9c4jmWiLM3WVdRXGV5hWOYY0aoASHPcbUV/weec y6z933m8FJdK8u7wpV0HB5hfelqi7jlNRYdU7I+uBgtailU+h5AFGJ7sKLO7hhrP yIr3HBG4I0U9LN3gPFUNaQUMlyFpXyjeBBpMFL7v9UJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=RB/muM AUIpD0VQ5P29QeDrb3c6ga94SzvUiFyutJqY8=; b=JvwlvZFkCEjL9s54gChl4z c4+KNdQpGn+aYtlYhIsVoiTCsWJu5SONKLHGc9CWxuz1GYbBOEp8unB4K5Py+RoX 0GyoFaJiqLaeVLLId7raEyUv3xzsxbyAEvkyaN7m46YB27wr3By4HD/e1DXj6gAo epczZhl8r6U7S9xbx/f1wuohq1n36a/2eN25yP23UTF6721hGtJ2j7uQzNGsgTK6 bgmoMYa+LabfRChmqLGBXyReLsxfy/KYM8pAzdZA/RlO/0KOQwd3iM1amP5TocFx vo4ks26r5h5f83/lWqrZi8GdLQsrXVtd6Gy7k2zNGiM5YUKfy/L0/kpkSA/r8keA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudehgedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvffuffgjkfggtgesthdtredttdertdenucfhrhhomheplfhoohhs thcumfhrvghmvghrshcuoehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmh eqnecuggftrfgrthhtvghrnhepgfefjeehfffffedtleffleefueeileeiudffheduvdev teevjeffudduhefhfeejnecuffhomhgrihhnpehgihhthhhusgdrtghomhdpsggrnhguph hlohhtrdhphienucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Sep 2021 14:54:05 -0400 (EDT) In-reply-to: Received-SPF: pass client-ip=66.111.4.26; envelope-from=joostkremers@fastmail.fm; helo=out2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133072 Archived-At: On Thu, Sep 16 2021, Hongyi Zhao wrote: > In Emacs, I run the python script [1] using `C-c C-c' provided with > the elpy package. A standalone window will be opened to show the > generated figure, as shown in the attached screenshot file. > > But I want to know whether I can let Emacs render the figure in its own frame. > > [1] https://github.com/hongyi-zhao/QEbandplot/blob/master/bandplot.py > > Any hints will be greatly appreciated. I have nothing ready-made to offer, but one option that comes to mind is to save the plot to a file instead of calling `plt.show()` and then have Emacs open that file. An alternative would be to use Org mode and put your code in a source block, then you can have the plot appear directly in your Org file below the source code. -- Joost Kremers Life has its moments