Opened 14 years ago

Closed 13 years ago

#2076 closed defect (fixed)

[with patch, positive review] Inconsistent coloring of plotted points

Reported by: jmitchell Owned by: mhansen
Priority: minor Milestone: sage-3.1.3
Component: graphics Keywords: color hue point plot 3
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

When I call,

sage: point(((1,1), (2,2), (3,3)), rgbcolor=hue(1), pointsize=30)

I expect to get a plot of 3 red points, but (1,1) is plotted as dark red and the other two points are blue. So far I've only been able to recreate this issue when only three points are in the tuple. The rgbcolor value doesn't seem to affect the color of the three plotted points.

I hope to look at the code soon.

Attachments (1)

trac_2076.patch (1.6 KB) - added by mhansen 13 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 14 years ago by mabshoff

  • Milestone set to sage-2.10.2

comment:2 Changed 14 years ago by was

Amazingly, this is a bug in matplotlib itself!

dhcp46-72:~ was$ sage -ipython
Python 2.5.1 (r251:54863, Feb  2 2008, 18:15:25) 
Type "copyright", "credits" or "license" for more information.

IPython 0.8.1 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from matplotlib.backends.backend_agg import FigureCanvasAgg

In [2]: from pylab import Figure

In [3]:  f = Figure()
   ...: 

In [4]: g = f.add_subplot(111)

In [5]: g.scatter([2.0, 3.0, 0.0], [2.0, 3.0, 0.0], s=300, c=(0.0,0.0,1.0))
Out[5]: <matplotlib.collections.RegularPolyCollection instance at 0x20f7878>

In [6]: canvas = FigureCanvasAgg(f)

In [7]: canvas.print_figure('foo.png')

In [8]: g.scatter([2.0, 3.0, 0.0, 1.0], [2.0, 3.0, 0.0, 1.0], s=300, c=(0.0,0.0,1.0))
Out[8]: <matplotlib.collections.RegularPolyCollection instance at 0x20fa8c8>

In [9]: canvas = FigureCanvasAgg(f)

In [10]:  canvas.print_figure('foo2.png')
   ....: 

In [11]: 
Do you really want to exit ([y]/n)? y
dhcp46-72:~ was$ open foo.png
dhcp46-72:~ was$ open foo2.png

Cleaner input in the Sage notebook:

sage: RealNumber = float; Integer=int
sage: from matplotlib.backends.backend_agg import FigureCanvasAgg
sage: from pylab import Figure
sage: f = Figure()
sage: g = f.add_subplot(111)
sage: g.scatter([2.0, 3.0, 0.0], [2.0, 3.0, 0.0], s=300, c=(0.0,0.0,1.0))
<matplotlib.collections.RegularPolyCollection instance at 0x7facfa8>
sage: canvas = FigureCanvasAgg(f)
sage: canvas.print_figure('foo.png')
sage: g.scatter([2.0, 3.0, 0.0, 1.0], [2.0, 3.0, 0.0, 1.0], s=300, c=(0.0,0.0,1.0))
<matplotlib.collections.RegularPolyCollection instance at 0x7fac328>
sage: canvas = FigureCanvasAgg(f)
sage: canvas.print_figure('foo.png')

comment:3 Changed 14 years ago by was

I propose the following:

  1. We upgrade from matplotlib-0.91.1 to the latest verison, whatever it is.
  1. If this doesn't fix the problem, report it to the matplotlib list.
  1. If that doesn't work, fix the problem !? Or program around it.

comment:4 Changed 13 years ago by mhansen

  • Owner changed from was to mhansen
  • Status changed from new to assigned

Changed 13 years ago by mhansen

comment:5 Changed 13 years ago by mhansen

  • Summary changed from Inconsistent coloring of plotted points to [with patch, needs review] Inconsistent coloring of plotted points

This is actually a bug on our part according to the matplotlib 0.98 documentation for scatter.

comment:6 Changed 13 years ago by jason

I've read the matplotlib docs and this looks reasonable. I don't have a current 3.1.2 tree to test it, though; so half of a positive review (the other half comes from applying it and checking the result of the doctest :).

comment:7 Changed 13 years ago by mabshoff

Jason,

since you now have a 3.1.2 can you do the final review on this? I can run doctests without a problem on 3.1.3.alpha1 to see if anything breaks.

Cheers,

Michael

comment:8 Changed 13 years ago by jason

The example now works and doctests in plot/*.py pass with the patch applied. So that's a full positive review, now.

comment:9 Changed 13 years ago by jason

  • Summary changed from [with patch, needs review] Inconsistent coloring of plotted points to [with patch, positive review] Inconsistent coloring of plotted points

comment:10 Changed 13 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from assigned to closed

Merged in Sage 3.1.3.alpha1

Note: See TracTickets for help on using tickets.