Opened 14 years ago

Closed 14 years ago

#4303 closed defect (duplicate)

Plotting: points(list_of_points, rgbcolor=c) gives strangely colored results with exactly 3 points.

Reported by: jbandlow Owned by: was
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: user interface Keywords: plotting
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


From the docstring for point2d, the following works fine:

sage: p = point(((0.5, 0.5), (1, 2), (0.5, 0.9), (-1,-1)), rgbcolor=hue(1), pointsize=30);


sage: p = point(((0.5, 0.5), (1, 2), (0.5, 0.9)), rgbcolor=hue(1), pointsize=30);

gives one purple(?) point and two blue points. This seems to happen if and only if the number of points specified is exactly three, regardless of the specified color.

Change History (2)

comment:1 Changed 14 years ago by mhampton

I wonder if this is related to the apparent special casing of 3 or fewer points in GraphicPrimitiveFactory_from_point_list (code below, from sage/plot/ That was the best lead I can find with the time I have, hope it helps.

class GraphicPrimitiveFactory_from_point_list(GraphicPrimitiveFactory):
    def __call__(self, points, coerce=True, **kwds):
            return points.plot(**kwds)
        except AttributeError:
        options = dict(self.options)
        for k, v in kwds.iteritems():
            options[k] = v

        if not isinstance(points, (list,tuple)) or \
           (isinstance(points,(list,tuple)) and len(points) <= 3 \
            and len(points) > 0 \
            and not isinstance(points[0], (list,tuple))):
                points = [[float(z) for z in points]]
            except TypeError:

            if len(points) > 0 and len(points[0]) == 3:
                return self._graphic3d()(points, coerce=coerce, **kwds)
        except (AttributeError, TypeError):
        xdata = []
        ydata = []
        if coerce:
            xdata = [float(z[0]) for z in points]
            ydata = [float(z[1]) for z in points]            
            xdata = [z[0] for z in points]
            ydata = [z[1] for z in points]            

        return self._from_xdata_ydata(xdata, ydata, True, options=options)

comment:2 Changed 14 years ago by mhansen

  • Milestone changed from sage-3.1.4 to sage-duplicate/invalid
  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of #2076.

Note: See TracTickets for help on using tickets.