#11787: error in creating graphics with numpy arrays
-----------------------------------------+----------------------------------
       Reporter:  jason                  |         Owner:  jason, was           
    
           Type:  enhancement            |        Status:  needs_work           
    
       Priority:  major                  |     Milestone:  sage-5.9             
    
      Component:  graphics               |    Resolution:                       
    
       Keywords:                         |   Work issues:                       
    
Report Upstream:  N/A                    |     Reviewers:  Luis Felipe Tabera 
Alonso
        Authors:  Punarbasu Purkayastha  |     Merged in:                       
    
   Dependencies:                         |      Stopgaps:                       
    
-----------------------------------------+----------------------------------

Comment (by ppurka):

 Replying to [comment:8 lftabera]:
 > The following test now provides an empty graphics
 >
 > list_plot([1, I, pi + I/2, CC(.25, .25)])

 Yikes! I learn something new everyday. I tried to avoid creating yet
 another list internally in the function by using `enumerate`. But this is
 an iterator and it runs through to the end of the list on one of the calls
 to `line` or `point`. And then if an exception is raised from those
 functions, then the list appears empty while trying the CC plots.

 >
 > I would try to avoid, if possible, the import of ndarray and testing for
 lists, tuples etc. It seems that line and plot can deal with ndarrays and
 ndarrays of ndarrays without problem.

 Indeed line and point can handle ndarrays. But the main problem is to
 detect when an empty array is passed in. Both those functions can not
 handle an empty numpy array. All this error checking was just to handle
 empty arrays :-|
 {{{
 sage: line(np.array([]))
 ...
 ValueError: there must be at least 2 points

 sage: line([])  # this is fine
 sage: point([]) # this is fine

 sage: point(np.array([]))
 ...
 AttributeError: 'int' object has no attribute '_set_extra_kwds'
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11787#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to