Opened 13 years ago

Closed 13 years ago

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

Reported by: Owned by: jbandlow was major sage-duplicate/invalid/wontfix user interface plotting

### Description

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); p.show()

However

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

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.

### comment:1 Changed 13 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/plot.py). 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):
try:
return points.plot(**kwds)
except AttributeError:
pass
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, (list,tuple))):
try:
points = [[float(z) for z in points]]
except TypeError:
pass

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

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

### comment:2 Changed 13 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.