show() vs. plot() on digraphs or posets

147 views
Skip to first unread message

Jori Mäntysalo

unread,
Jun 8, 2015, 6:59:22 AM6/8/15
to sage-...@googlegroups.com
Documentation on posets.py seems to say that show() accepts some
parameters "in itself" and others to be forwarded to plot(). But is there
really anything on the first class?

Or to put it other way: can documentation of show() be simplified to
something like "Display the Hasse diagram of the poset. For options see
(link to plot())."?

--
Jori Mäntysalo

Sébastien Labbé

unread,
Jun 8, 2015, 8:16:28 AM6/8/15
to sage-...@googlegroups.com
When reading graph_plot.py doc [1], I thought figsize was accepted by show but not by plot:

sage: from sage.graphs.graph_plot import DEFAULT_PLOT_OPTIONS, DEFAULT_SHOW_OPTIONS
sage: [o for o in DEFAULT_SHOW_OPTIONS if o not in DEFAULT_PLOT_OPTIONS]
['figsize']

but when I do the following, I realize that plot actually uses the figsize argument :

sage: G = graphs.PetersenGraph()
sage: G.show(figsize=[20,20])
Launched png viewer for Graphics object consisting of 26 graphics primitives
sage: G.plot(figsize=[20,20])
Launched png viewer for Graphics object consisting of 26 graphics primitives

So, the question is still open.

Sébastien

[1] http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/graph_plot.html

Jori Mäntysalo

unread,
Jun 8, 2015, 8:27:57 AM6/8/15
to sage-...@googlegroups.com
On Mon, 8 Jun 2015, Sébastien Labbé wrote:

> When reading graph_plot.py doc [1], I thought figsize was accepted by show
> but not by plot: - - So, the question is still open.

Just the same issue that I found...

There might be something like axes_*() or so, but they will do nothing (or
do something silly) with posets.

--
Jori Mäntysalo

Nathann Cohen

unread,
Jun 8, 2015, 10:44:51 AM6/8/15
to sage-...@googlegroups.com
Hello guys,

I don't know anything about Poset's show/plot functions. For Graph.plot(), however, it is true that it is never said explicitly that additional parameters will be forwarded to matplotlib. It is done in Graph.show? but not in Graph.plot?.

I'll patch that soon.

Nathann

Jori Mäntysalo

unread,
Jun 9, 2015, 3:44:31 AM6/9/15
to sage-...@googlegroups.com
On Mon, 8 Jun 2015, Nathann Cohen wrote:

> I don't know anything about Poset's show/plot functions. For Graph.plot(),
> however, it is true that it is never said explicitly that additional
> parameters will be forwarded to matplotlib. It is done in Graph.show? but
> not in Graph.plot?.

But there the documentation seems to be clear:
http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.show
says that show() has two set of options: one is only "method" that is
accepted by show, not by plot, and other set is all options for plot.

At
http://doc.sagemath.org/html/en/reference/combinat/sage/combinat/posets/posets.html#sage.combinat.posets.posets.FinitePoset.show
it is said that for example "label_elements" is an option, but actually it
is available also with plot().

But I would like to be sure that .show(...options...) is just a shortcut
to .plot(...options...).show() for posets. For graphs it is not.

--
Jori Mäntysalo

Nathann Cohen

unread,
Jun 9, 2015, 7:27:21 AM6/9/15
to Sage devel
> But I would like to be sure that .show(...options...) is just a shortcut to
> .plot(...options...).show() for posets. For graphs it is not.

Well, the reason for that is that
graphs.PetersenGraph().show(method="js") is not really a plot. Maybe
it also makes sense for Posets, by the way.

Nathann

Jori Mäntysalo

unread,
Jun 9, 2015, 8:59:17 AM6/9/15
to Sage devel
At least for now it just says "TypeError: matplotlib() got an unexpected
keyword argument 'method'".

--
Jori Mäntysalo

Nathann Cohen

unread,
Jun 9, 2015, 9:05:20 AM6/9/15
to Sage devel
> At least for now it just says "TypeError: matplotlib() got an unexpected
> keyword argument 'method'".

Good news. I remember a time when it would have ignored the parameter,
and plotted the usual thing :-P

Nathann

Nathann Cohen

unread,
Jun 9, 2015, 9:37:22 AM6/9/15
to sage-...@googlegroups.com
I'll patch that soon.

Done in #18646  (needs_review).

Nathann

Jori Mäntysalo

unread,
Jul 1, 2015, 5:12:39 AM7/1/15
to sage-...@googlegroups.com
Anybody knows about this...?
When thinking about this, maybe Poset.plot parameters should be "totally
poset-aware": we already have cover_labels instead of edge_labels, but we
don't have element_size as a kind of alias to vertex_size and so on. But
first I need an answer to question above.

--
Jori Mäntysalo
Reply all
Reply to author
Forward
0 new messages