Giter VIP home page Giter VIP logo

Comments (2)

johnyf avatar johnyf commented on September 27, 2024

Thank you for reporting this. The Exception is raised at:

if self.dim != 2:
raise Exception("Cannot plot polytopes of dimension larger than 2")

Following the changes of the code in the past, the test of dimension != 2, and the message have been essentially unchanged since this code was introduced (the message has changed by removing a whitespace character), in tulip: tulip-control/tulip-control@85a9ef3#diff-a3402e018e75772f98fab2fad2a90be9bb565a04576ec077b6e5f5aebb5d89beR94-R96

Initially, this check printed a message and returned early from the call. Later, printing changed to logging, and logging to raising an exception (this change was in 8407888).

Regarding possibilities for change, the existing implementation of the function polytope.polytope._get_patch passes the polytope vertices to the constructor of the class matplotlib.patches.Polygon:

patch = mpl.patches.Polygon(V[ind, :], True, **kwargs)

The docstring of the class matplotlib.patches.Polygon requires two-dimensional points:

https://github.com/matplotlib/matplotlib/blob/cc1f776fd109090d833cb4250b56665a3746c55f/lib/matplotlib/patches.py#L1074

So with the current implementation, plotting one-dimensional polytopes is not supported. If this is ever implemented, some convention would be needed, e.g., that one-dimensional polytopes are plotted on the x-axis. Until then, the proposed change of replacing the word "larger" with "other" appears to be a good choice.

This issue applies also to the analogous test and message about regions (a class that can represent polytopes that can be nonconvex):

if self.dim != 2:
raise Exception("Cannot plot region of dimension larger than 2")

from polytope.

johnyf avatar johnyf commented on September 27, 2024

Addressed in commit ed6e798, which is now included in the mainline branch.

from polytope.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.