Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14181 closed enhancement (duplicate)

Add wireframe=False option for rendering 2d polyhedron plots

Reported by: nthiery Owned by: mhampton
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: geometry Keywords:
Cc: sage-combinat Merged in:
Authors: Reviewers: Volker Braun, Nicolas M. Thiéry
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #14175 Stopgaps:

Status badges

Description (last modified by nthiery)

Implement:

sage: square_from_vertices = Polyhedron(vertices = [[1, 1], [1, -1], [-1, 1], [-1, -1]])
sage: square_from_vertices.plot()
sage: square_from_vertices.plot(wireframe=False)

In the later case, only the two-dimensional piece of the polyhedron is drawn, and not its wireframe: vertices and edges.

This feature is implemented by #14175.

Change History (15)

comment:1 Changed 8 years ago by nthiery

  • Status changed from new to needs_review

comment:2 follow-up: Changed 8 years ago by vbraun

You can, in principle, only drawn projections in 2 or 3 dimensions. There is no such thing as "drawing a non-projected polyhedron".

If you want to implement your own plotting style then you should create the projection and use the methods of the Projection object directly.

comment:3 in reply to: ↑ 2 Changed 8 years ago by nthiery

Replying to vbraun:

You can, in principle, only drawn projections in 2 or 3 dimensions. There is no such thing as "drawing a non-projected polyhedron".

If you want to implement your own plotting style then you should create the projection and use the methods of the Projection object directly.

I guess there is a misunderstanding here:-)

This ticket is just about drawing *without outline* Polyhedrons living in a dimension 2 ambient space. This is all I need for #4327.

If I mentionned projections that's just because, if someone would want the same feature for a Polyhedron that has been projected in dimension 2, then this is not yet handled by this patch.

Cheers,

Nicolas

comment:4 Changed 8 years ago by vbraun

I think I understand what you want, but it is at odds with the strict separation of polyhedron and its projection that I very much would like to keep in the code.

Having more control about the plot output is definitely desirable, but I find outline as a keyword very confusing. X.plot(outline=True) sounds like it ought to plot only the outline of X, but thats not what you propose.

If you just want to draw a polygon you only need

sage: P = Polyhedron([(0,0),(1,0),(0,1)])
sage: polygon2d(P.vertices())

comment:5 follow-up: Changed 8 years ago by vbraun

How about we let the user specify three dictionaries

P.plot(point={color='red'}, line={...}, polygon={...})

that are then passed to the **kwds of the respective graphics objects. And as special case you can specify None to switch them off. Then your outline-free plot would just be

P.plot(point=None, line=None)

comment:6 in reply to: ↑ 5 ; follow-up: Changed 8 years ago by nthiery

Replying to vbraun:

How about we let the user specify three dictionaries

P.plot(point={color='red'}, line={...}, polygon={...})

that are then passed to the **kwds of the respective graphics objects. And as special case you can specify None to switch them off. Then your outline-free plot would just be

P.plot(point=None, line=None)

Not quite: if P is a polyhedron of dimension 1 in an ambient space of dimension 2, then I want it to be drawn as a line (no points, no polygon). Similarly, if P is a point, I want it to be drawn as a point (no line, no polygon). See the examples in the patch.

I agree that the name "outline" is not good. What I really mean is "draw only the piece of the same dimension as P", but I did not manage to get a good name for that. Suggestions?

Thanks for the brainstorming :-)

Nicolas

comment:7 Changed 8 years ago by nthiery

  • Dependencies set to #14175

Rebased upon #14175 (creating conflicts with myself ...)

comment:8 in reply to: ↑ 6 ; follow-up: Changed 8 years ago by vbraun

Replying to nthiery:

Not quite: if P is a polyhedron of dimension 1 in an ambient space of dimension 2, then I want it to be drawn as a line (no points, no polygon). Similarly, if P is a point, I want it to be drawn as a point (no line, no polygon).

Whats the expected output if the polyhedron is of dimension > 3?

comment:9 in reply to: ↑ 8 Changed 8 years ago by nthiery

Replying to vbraun:

Replying to nthiery:

Not quite: if P is a polyhedron of dimension 1 in an ambient space of dimension 2, then I want it to be drawn as a line (no points, no polygon). Similarly, if P is a point, I want it to be drawn as a point (no line, no polygon).

Whats the expected output if the polyhedron is of dimension > 3?

Well, since I don't have a need for this feature I might not have the right perspective to have good insight :-) I guess the natural analogue would be to take the projected polyhedron and only draw it's non trivial face of highest dimension. E.g. if we started from some hypercube in 4D that would project onto a cube in 3D, then that cube would be drawn without its wireframe.

Cheers,

comment:10 Changed 8 years ago by vbraun

  • Milestone changed from sage-5.8 to sage-duplicate/invalid/wontfix

With my patch at #14175 this ticket would be obsolete, I think. I propose to close it as duplicate.

comment:11 Changed 8 years ago by nthiery

  • Description modified (diff)
  • Status changed from needs_review to positive_review
  • Summary changed from Add outline=False option for rendering 2d polyhedron plots to Add wireframe=False option for rendering 2d polyhedron plots

comment:12 Changed 8 years ago by nthiery

  • Description modified (diff)

comment:13 Changed 8 years ago by nthiery

  • Authors Nicolas M. Thiéry deleted
  • Reviewers changed from Voker Braun? to Voker Braun, Nicolas M. Thiéry

comment:14 Changed 8 years ago by jdemeyer

  • Resolution set to duplicate
  • Status changed from positive_review to closed

comment:15 Changed 8 years ago by jdemeyer

  • Reviewers changed from Voker Braun, Nicolas M. Thiéry to Volker Braun, Nicolas M. Thiéry
Note: See TracTickets for help on using tickets.