For now, perhaps the workaround is to use

plot(lambda x: h(x)).show(xmin=0, xmax=1)

Note that xmin, xmax work properly only with show when xmax < xmin. ymin, ymax work with both plot() and show() and is used to "zoom in" on the rendered graph. This is ticket
http://trac.sagemath.org/ticket/13368

If you ever intend to flip a graph, then use the usual format instead of xmin, xmax in the case xmax < xmin:
plot(lambda x: h(x), (x, 0, 1))
plot(lambda x: h(x), (x, 0, 1)).show(xmax=0, xmin=1)

 - basu.

On 12/19/2013 01:38 AM, Alden wrote:
Given what the patch is supposed to do, it seems like it should fix it.
  However, when I try to install the patch, I get the error "abort:
failed to synchronize metadata for "sage/plot/plot.py".  Anyway, not a
huge deal, so I guess I should just wait until the patch is integrated
in sage 6.1.

On Tuesday, December 17, 2013 5:36:34 PM UTC-6, P Purkayastha wrote:

    Does the patch here help: http://trac.sagemath.org/ticket/15030
    <http://trac.sagemath.org/ticket/15030> ?

    On 12/18/2013 06:48 AM, Alden wrote:
     > I wrote a class with a __call__ method, and I want to plot an
    instance
     > of it using plot() in the sage notebook.  I run the commands:
     >
     > import circle_homeo
     > import cyclic_order
     > h = circle_homeo.PSL2R_action(cyclic_order.CyclicOrder('abAB'))[0]
     >
     > (this doesn't matter; all that should matter is that h is some
    callable
     > class)
     >
     > plot(h, xmin=0, xmax=1)
     >
     > returns the error:
     >
     > *****************************************
     > Traceback (most recent call last):
     >    File "<stdin>", line 1, in <module>
     >    File "_sage_input_32.py", line 10, in <module>
     >      exec compile(u'open("___code___.py","w").write("# -*-
    coding: utf-8
     > -*-\\n" +
     >
    
_support_.preparse_worksheet_cell(base64.b64decode("cGxvdChoLCB4bWluPTAsIHhtYXg9MSk="),globals())+"\\n");

     > execfile(os.path.abspath("___code___.py"))
     >    File "", line 1, in <module>
     >    File "/tmp/tmpnBGA3K/___code___.py", line 3, in <module>
     >      exec compile(u'plot(h, xmin=_sage_const_0 ,
    xmax=_sage_const_1 )
     >    File "", line 1, in <module>
     >    File
     >
    
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/misc/decorators.py",

     > line 692, in wrapper
     >      return func(*args, **kwds)
     >    File
     >
    
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/misc/decorators.py",

     > line 537, in wrapper
     >      return func(*args, **options)
     >    File
     >
    
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/plot.py",

     > line 1130, in plot
     >      G = _plot(funcs, (xmin, xmax), **kwds)
     >    File
     >
    
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/plot.py",

     > line 1236, in _plot
     >      funcs, ranges = setup_for_eval_on_grid(funcs, [xrange],
     > options['plot_points'])
     >    File
     >
    
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/misc.py",

     > line 148, in setup_for_eval_on_grid
     >      return fast_float(funcs, *vars,**options),
     > [tuple(range+[range_step]) for range,range_step in zip(ranges,
    range_steps)]
     >    File "fast_eval.pyx", line 1377, in sage.ext.fast_eval.fast_float
     > (sage/ext/fast_eval.c:9718)
     > AttributeError: EquivariantRHomeo instance has no attribute
    '__float__'
     > *******************************************
     >
     > However, if I do:
     >
     > f = lambda x:h(x)
     > plot(f, xmin=0, xmax=1)
     >
     > That works fine.  Is there something I need to do to the class to
     > convince plot() to call it?
     >
     >
     > --
     > You received this message because you are subscribed to the Google
     > Groups "sage-support" group.
     > To unsubscribe from this group and stop receiving emails from it,
    send
     > an email to sage-support...@googlegroups.com <javascript:>.
     > To post to this group, send email to sage-s...@googlegroups.com
    <javascript:>.
     > Visit this group at http://groups.google.com/group/sage-support
    <http://groups.google.com/group/sage-support>.
     > For more options, visit https://groups.google.com/groups/opt_out
    <https://groups.google.com/groups/opt_out>.

--
You received this message because you are subscribed to the Google
Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to