sage.plot.graphics.GraphicsArray no longer available?

117 views
Skip to first unread message

Pong

unread,
Oct 23, 2019, 1:24:08 PM10/23/19
to sage-devel
I have updated to the latest sage (from the cocalc git) last night and have just found out that the module sage.plot.graphics.GraphicsArray is no longer available.
Is that true? If so, what would be a replacement for that? 

Pong

unread,
Oct 23, 2019, 1:46:10 PM10/23/19
to sage-devel
Sorry for jumping the gun.

The improved version is
sage.plot.multigraphics.GraphicsArray(array)

Eric Gourgoulhon

unread,
Oct 24, 2019, 8:14:14 AM10/24/19
to sage-devel
Le mercredi 23 octobre 2019 19:46:10 UTC+2, Pong a écrit :
Sorry for jumping the gun.

The improved version is
sage.plot.multigraphics.GraphicsArray(array)



For the curious: the reason of this change is that GraphicsArray now inherits from a new class, MultiGraphics, which fixes some previous issues and paves the way for graphics insets, in preparation at #27866.

Eric.

kcrisman

unread,
Oct 25, 2019, 7:32:49 AM10/25/19
to sage-devel
I didn't think that this would break any code - is it a very likely thing that people would have been importing this class explicitly instead of using the wrapper?

William

unread,
Oct 29, 2019, 2:19:51 PM10/29/19
to sage-devel


On Friday, October 25, 2019 at 4:32:49 AM UTC-7, kcrisman wrote:
I didn't think that this would break any code - is it a very likely thing that people would have been importing this class explicitly instead of using the wrapper?

It's (obviously) likely that at least one person did that.   This is part of the public API of Sage, so it would be good if it were deprecated before removal (or just left in via a one-liner redirect import).   As soon as I saw this code, I suspected this would happen, so I rewrote our client code (for cocalc) to be more robust... https://github.com/sagemathinc/cocalc/commit/bbe5ead182358e40427dc7884445099fdb4fc818#diff-a103ad80295a75843b8e11e34da98611

 

Eric Gourgoulhon

unread,
Oct 29, 2019, 4:17:02 PM10/29/19
to sage-devel
Le mardi 29 octobre 2019 19:19:51 UTC+1, William a écrit :

It's (obviously) likely that at least one person did that.   This is part of the public API of Sage, so it would be good if it were deprecated before removal (or just left in via a one-liner redirect import).  

Sorry about that.  Since the user interface graphics_array() was left unchanged, I did not felt necessary to add a deprecation notice. Actually the main reason why I moved GraphicsArray from graphics.py to the new file multi_graphics.py is that the former was already more than 3,500 lines long. I could of course have added the new class MultiGraphics in graphics.py, but this would have resulted in a file of ~ 4,700 lines... Currently (Sage 9.0.beta3) the situation in src/sage/plot is as follows:

- graphics.py (3,318 lines --> 3403 lines in 9.0.beta4): class Graphics
- multi_graphics.py (878 lines --> 1318 lines in 9.0.beta4): class MultiGraphics and the derived class GraphicsArray.

The user interface is via the following functions/methods:

- graphics_array(): creates a GraphicsArray
- multi_graphics(): creates a MultiGraphics from a list of Graphics objects and positions (to appear in Sage 9.0.beta4, cf #27866)
- Graphics.inset(): creates an inset in a Graphics (returns a MultiGraphics)

Best wishes,

Eric.

Eric Gourgoulhon

unread,
Oct 29, 2019, 4:37:18 PM10/29/19
to sage-devel
Le mardi 29 octobre 2019 21:17:02 UTC+1, Eric Gourgoulhon a écrit :
Le mardi 29 octobre 2019 19:19:51 UTC+1, William a écrit :

It's (obviously) likely that at least one person did that.   This is part of the public API of Sage, so it would be good if it were deprecated before removal (or just left in via a one-liner redirect import).  

Sorry about that.  Since the user interface graphics_array() was left unchanged, I did not felt necessary to add a deprecation notice.

Do you think it's necessary to add a redirect import for GraphicsArray from sage.plot.graphics? We can easily make a new ticket to fix this for Sage 9.0.

Eric.

William Stein

unread,
Oct 29, 2019, 6:49:41 PM10/29/19
to sage-devel
I don't think it is strictly necessary, but I personally think it
would be nice since at least two people were explicitly importing
that: (1) me -- for cocalc, and (2) the original poster, Pong, in
this thread. There could easily be other people doing the same
thing...

William

--
William (http://wstein.org)

Eric Gourgoulhon

unread,
Oct 29, 2019, 7:25:53 PM10/29/19
to sage-devel

kcrisman

unread,
Oct 30, 2019, 1:42:44 PM10/30/19
to sage-devel
William, thanks for chiming in on this - I did not review the ticket but did look at it some, and the possibility that import would no longer work (but was an API) did not occur to me, as for Eric.  Glad there should be an easy fix.

Eric Gourgoulhon

unread,
Oct 31, 2019, 4:02:25 AM10/31/19
to sage-devel
Le mercredi 30 octobre 2019 00:25:53 UTC+1, Eric Gourgoulhon a écrit :

I've turned  https://trac.sagemath.org/ticket/28675 into a deprecation notice for GraphicsArray import from sage.plot.graphics. This seems more useful for the long term than a silent redirection of import. Please review.

Eric.

Reply all
Reply to author
Forward
0 new messages