GNU bug report logs -
#62783
[PATCH] comint-mime: Add Matplotlib support in the standard interpreter
Previous Next
Reported by: James Thomas <jimjoe <at> gmx.net>
Date: Tue, 11 Apr 2023 23:19:02 UTC
Severity: wishlist
Tags: notabug, patch
Fixed in version 29.1
Done: Augusto Stoffel <arstoffel <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62783 in the body.
You can then email your comments to 62783 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
arstoffel <at> gmail.com, bug-gnu-emacs <at> gnu.org
:
bug#62783
; Package
emacs
.
(Tue, 11 Apr 2023 23:19:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
James Thomas <jimjoe <at> gmx.net>
:
New bug report received and forwarded. Copy sent to
arstoffel <at> gmail.com, bug-gnu-emacs <at> gnu.org
.
(Tue, 11 Apr 2023 23:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Severity: wishlist
Tags: notabug, patch
This adds support for Matplotlib using the standard interpreter (rather
than IPython). It was tested like this:
M-x run-python
M-x comint-mime-setup
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> ax.plot([1, 2, 3, 4], [1, 4, 2, 3])
>>> plt.show()
I haven't tested whether this breaks the existing IPython functionality
- but see no reason why it should.
In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2023-04-01 built on
user-Inspiron-15-5518
Repository revision: 6419d78fa6f8a7794893da5a8a5d65f75a5a29fa
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Ubuntu 22.04.2 LTS
[0001-Add-Matplotlib-support-in-the-standard-interpreter.patch (text/patch, attachment)]
[Message part 3 (text/plain, inline)]
(This is a duplicate message to the maintainer; because I suspect that a
previous direct follow-up of mine to him has gone to spam)
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62783
; Package
emacs
.
(Wed, 12 Apr 2023 06:45:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 62783 <at> debbugs.gnu.org (full text, mbox):
On Wed, 12 Apr 2023 at 04:48, James Thomas wrote:
> Severity: wishlist
> Tags: notabug, patch
>
> This adds support for Matplotlib using the standard interpreter (rather
> than IPython). It was tested like this:
>
> M-x run-python
> M-x comint-mime-setup
>>>> import matplotlib.pyplot as plt
>>>> fig, ax = plt.subplots()
>>>> ax.plot([1, 2, 3, 4], [1, 4, 2, 3])
>>>> plt.show()
>
> I haven't tested whether this breaks the existing IPython functionality
> - but see no reason why it should.
Thanks, I will have a look at this soon.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62783
; Package
emacs
.
(Wed, 12 Apr 2023 10:33:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 62783 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Augusto Stoffel wrote:
> Thanks, I will have a look at this soon.
Please prefer this slightly modified patch. It makes it possible for
users to switch backends at the beginning with matplotlib.use even if
comint-mime is enabled.
[0001-Add-Matplotlib-support-in-the-standard-interpreter.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62783
; Package
emacs
.
(Sun, 16 Apr 2023 10:57:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 62783 <at> debbugs.gnu.org (full text, mbox):
On Wed, 12 Apr 2023 at 16:02, James Thomas wrote:
> Augusto Stoffel wrote:
>
>> Thanks, I will have a look at this soon.
>
> Please prefer this slightly modified patch. It makes it possible for
> users to switch backends at the beginning with matplotlib.use even if
> comint-mime is enabled.
Okay, I tested and it works for me, but I have a question: If I call
just call the plot function I get e.g
>>> plt.plot([1,2,1])
[<matplotlib.lines.Line2D object at 0x7ffb2cca0a10>]
I still need to call plt.show() afterwards to see the image. This is
better than nothing, but would be nice if the extra step wasn't
necessary. Also, it seems I also need to call plt.close() manually,
otherwise subsequent calls to plt.plot add to the figure instead of
starting a new one.
Do you know if the mechanics here can be refined?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62783
; Package
emacs
.
(Thu, 20 Apr 2023 05:19:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 62783 <at> debbugs.gnu.org (full text, mbox):
Augusto Stoffel wrote:
> Also, it seems I also need to call plt.close() manually, otherwise
> subsequent calls to plt.plot add to the figure instead of starting a
> new one.
pyplot.show displays _all_ open 'figure's. If you want to display a
particular figure, fig.show() can be used. Also, pyplot.close can close
figures selectively.
Subsequent calls of pyplot.plot add to the 'current' figure which it
keeps track of (and that can be switched).
> >>> plt.plot([1,2,1])
> [<matplotlib.lines.Line2D object at 0x7ffb2cca0a10>]
>
> I still need to call plt.show() afterwards to see the image. This is
> better than nothing, but would be nice if the extra step wasn't
> necessary.
I guess it would be straightforward to implement a pretty-printer for
the Line2D object that would call its figure.show, but for the sake of
completeness this would have to be done also for every kind of element
in a figure other than lines - like axes or legends.
Also, personally, I would find it annoying if every change I make to a
figure would result in a redisplay. Sometimes I want to accumulate
changes before showing the result.
(I'm rather new to all this myself and the above is only to the best of
my knowledge)
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#62783
; Package
emacs
.
(Fri, 21 Apr 2023 12:44:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 62783 <at> debbugs.gnu.org (full text, mbox):
All right, thanks for the info. I've installed your patch (with some
refactoring in a subsequent commit). Let me know if all is good. I
haven't made a new release yet, but will do so soon.
On Thu, 20 Apr 2023 at 10:47, James Thomas wrote:
> Also, personally, I would find it annoying if every change I make to a
> figure would result in a redisplay. Sometimes I want to accumulate
> changes before showing the result.
>
> (I'm rather new to all this myself and the above is only to the best of
> my knowledge)
Okay. It seems to me that IPython's approach makes sense, whatever the
exact rules are. But we can always refine things later.
bug marked as fixed in version 29.1, send any further explanations to
62783 <at> debbugs.gnu.org and James Thomas <jimjoe <at> gmx.net>
Request was from
Augusto Stoffel <arstoffel <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 21 Apr 2023 12:48:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 20 May 2023 11:24:12 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 28 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.