First time here? Check out the FAQ!

Ask Your Question
2

Why does graph plotting crop so aggressively, and what is a work-around?

asked 13 years ago

Sammy Black gravatar image

updated 2 years ago

tmonteil gravatar image

Surely, the Sage community is aware of this bug. For example, there is this ticket, in which the problem is supposed to be fixed. But it's not!

A patch is described: in sage/graphs/graph_plot.py we can add the line(?)

G._extra_kwds['axes_pad']=.05

Am I to change this value in order to fix this over-zealous cropping behavior? No matter what I do, in this regard, I still end up with graph vertices partially cut off.

What's the easy work-around? I would like to be able to plot graphics_array objects with several graphs (with their vertices clearly shown!).

(http://trac.sagemath.org/sage_trac/ti...)

Preview: (hide)

Comments

I'm keenly interested in this too, and have been for a while (although I haven't gotten around to trying to figure it out).

niles gravatar imageniles ( 13 years ago )

Can you post code that replicates the problem and the Sage version you are using. In 4.6.2 I do: sage: g = Graph({0:{1:'a'}, 1:{2:'b'}, 2:{0:'c'}}); g.plot() --- and I get a nice triangle, no cropping occurs. I tried a bunch of other graphs from the database and they all seem fine too.

benjaminfjones gravatar imagebenjaminfjones ( 13 years ago )

Ah.. it's probably because the `axes_pad` doesn't get passed to the graphics array.

benjaminfjones gravatar imagebenjaminfjones ( 13 years ago )

@benjaminfjones: I am using 4.5.3. Perhaps it's time for an upgrade. :)

Sammy Black gravatar imageSammy Black ( 13 years ago )

2 Answers

Sort by » oldest newest most voted
3

answered 13 years ago

benjaminfjones gravatar image

Try this:

sage: g1 = Graph({0:{1:'a'}, 1:{2:'b'}, 2:{0:'c'}})
sage: g2 = Graph({0:{1:'a'}, 1:{2:'b'}, 2:{3:'c'}, 3:{0:'d'}})
sage: G = graphics_array([g1.plot(), g2.plot()])
sage: G.show(axes_pad=0.1)
Preview: (hide)
link

Comments

Thanks. I wasn't using the keyword `axes_pad` explicitly, but rather trying to hack the `graph_plot.py` module. This works.

Sammy Black gravatar imageSammy Black ( 13 years ago )

I wish somebody would fix this at Sage Days 29 right now!

William Stein gravatar imageWilliam Stein ( 13 years ago )

Michael D. would be a natural person to take a look at this, if he wants to dive into the Sage plotting code. He might glance at #9211 and see what he thinks about it.

Jason Grout gravatar imageJason Grout ( 13 years ago )
2

answered 13 years ago

Jason Grout gravatar image

updated 13 years ago

See #9211, where a better explanation of the cropping problem and a rough patch are waiting for cleanup and review (from 9 months ago!)

Preview: (hide)
link

Comments

For the record, this bug is fixed since sage-4.8

tmonteil gravatar imagetmonteil ( 11 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 13 years ago

Seen: 1,224 times

Last updated: Mar 21 '11