Ticket #5651: trac5651-rebase.patch

File trac5651-rebase.patch, 22.5 KB (added by wcauchois, 14 years ago)

based on sage 4.1.alpha2 (fixed, whoops)

  • sage/plot/arrow.py

    # HG changeset patch
    # User Bill Cauchois <wcauchois@gmail.com>
    # Date 1246480710 14400
    # Node ID 590a3f0bef5481e03ca80fc311641e1a20bfd136
    # Parent  f19f590fa74a69f5b3a753a6814a81bb6bc2e783
    trac #5651 -- Make it so that plot(...) passes extra options to show.
    
    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/arrow.py
    a b  
    378378
    379379        sage: line([(0,0),(1,0)],thickness=10)+line([(0,1),(1,1)], thickness=10)+arrow((0.5,0),(0.5,1), arrowshorten=10,rgbcolor=(1,0,0))
    380380
     381    Extra options will get passed on to show(), as long as they are valid::
     382 
     383        sage: arrow((-2, 2), (7,1), frame=True)
     384        sage: arrow((-2, 2), (7,1)).show(frame=True)
    381385    """
    382386    from sage.plot.plot import Graphics
    383387    g = Graphics()
     388    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    384389    if headpoint is not None and tailpoint is not None:
    385390        xtail, ytail = tailpoint
    386391        xhead, yhead = headpoint
  • sage/plot/bar_chart.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/bar_chart.py
    a b  
    127127    A bar_chart with negative values and red bars::
    128128
    129129        sage: bar_chart([-3,5,-6,11], rgbcolor=(1,0,0))
     130
     131    Extra options will get passed on to show(), as long as they are valid:
     132        sage: bar_chart([-2,8,-7,3], rgbcolor=(1,0,0), axes=False)
     133        sage: bar_chart([-2,8,-7,3], rgbcolor=(1,0,0)).show(axes=False) # These are equivalent
    130134    """
    131135    dl = len(datalist)
    132136    #if dl > 1:
     
    142146        #cnt += 1
    143147
    144148    g = Graphics()
     149    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    145150    #TODO: improve below for multiple data sets!
    146151    #cnt = 1
    147152    #for ind, pnts, xrange, yrange in bardata:
  • sage/plot/bezier_path.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/bezier_path.py
    a b  
    167167        sage: path = [[(0,0),(.5,1),(1,0)]]
    168168        sage: curve = bezier_path(path, linestyle='dashed', rgbcolor='green')
    169169        sage: curve
     170
     171    Extra options will get passed on to show(), as long as they are valid:
     172
     173        sage: bezier_path([[(0,1),(.5,0),(1,1)]], fontsize=50)
     174        sage: bezier_path([[(0,1),(.5,0),(1,1)]]).show(fontsize=50) # These are equivalent
    170175    """
    171176    from sage.plot.plot import Graphics
    172177    g = Graphics()
     178    g._set_extra_kwds(g._extract_kwds_for_show(options))
    173179    g.add_primitive(BezierPath(path, options))
    174180    return g
    175181   
  • sage/plot/circle.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/circle.py
    a b  
    275275
    276276        sage: C = circle((2,3), 1, fill=True, edgecolor='blue', rgbcolor='green', hue=.8)
    277277
     278    Extra options will get passed on to show(), as long as they are valid::
     279
     280        sage: circle((0, 0), 2, figsize=[10,10]) # That circle is huge!
     281        sage: circle((0, 0), 2).show(figsize=[10,10]) # These are equivalent
     282
    278283    TESTS:
    279284
    280285    We cannot currently plot circles in more than three dimensions::
     
    286291    """
    287292    from sage.plot.plot import Graphics
    288293    g = Graphics()
     294    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    289295    g.add_primitive(Circle(center[0], center[1], radius, options))
    290296    if len(center)==2:
    291297        return g
  • sage/plot/complex_plot.pyx

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/complex_plot.pyx
    a b  
    276276    The Riemann Zeta function::
    277277
    278278        sage: complex_plot(zeta, (-30,30), (-30,30))
     279
     280    Extra options will get passed on to show(), as long as they are valid::
     281
     282        sage: complex_plot(lambda z: z, (-3, 3), (-3, 3), figsize=[1,1])
     283        sage: complex_plot(lambda z: z, (-3, 3), (-3, 3)).show(figsize=[1,1]) # These are equivalent
    279284    """
    280285    from sage.plot.plot import Graphics, setup_for_eval_on_grid
    281286    cdef double x, y
     
    289294                                            for y in yrange_list]
    290295    _sig_off
    291296    g = Graphics()
     297    g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax']))
    292298    g.add_primitive(ComplexPlot(z_values, xrange, yrange, options))
    293299    return g
  • sage/plot/contour_plot.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/contour_plot.py
    a b  
    241241
    242242        sage: x,y = var('x,y')
    243243        sage: contour_plot(x^2+y^2-2,(x,-1,1), (y,-1,1)).show(aspect_ratio=1)
     244
     245    Extra options will get passed on to show(), as long as they are valid::
     246
     247        sage: f(x, y) = cos(x) + sin(y)
     248        sage: contour_plot(f, (0, pi), (0, pi), axes=False)
     249        sage: contour_plot(f, (0, pi), (0, pi)).show(axes=False) # These are equivalent
    244250    """
    245251    from sage.plot.plot import Graphics, setup_for_eval_on_grid
    246252    g, xstep, ystep, xrange, yrange = setup_for_eval_on_grid([f], xrange, yrange, options['plot_points'])
     
    249255                              for y in xsrange(yrange[0], yrange[1], ystep, include_endpoint=True)]
    250256
    251257    g = Graphics()
     258    g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax']))
    252259    g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, options))
    253260    return g       
    254261
  • sage/plot/density_plot.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/density_plot.py
    a b  
    209209
    210210        sage: density_plot(y^2 + 1 - x^3 - x, (y,-pi,pi), (x,-pi,pi))
    211211        sage: density_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi))
     212
     213    Extra options will get passed on to show(), as long as they are valid::
     214
     215        sage: density_plot(log(x) + log(y), (x, 1, 10), (y, 1, 10), dpi=20)
     216        sage: density_plot(log(x) + log(y), (x, 1, 10), (y, 1, 10)).show(dpi=20) # These are equivalent
    212217    """
    213218    from sage.plot.plot import Graphics, setup_for_eval_on_grid
    214219    g, xstep, ystep, xrange, yrange = setup_for_eval_on_grid([f], xrange, yrange, options['plot_points'])
     
    217222                              for y in xsrange(yrange[0], yrange[1], ystep, include_endpoint=True)]
    218223
    219224    g = Graphics()
     225    g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax']))
    220226    g.add_primitive(DensityPlot(xy_data_array, xrange, yrange, options))
    221227    return g
  • sage/plot/disk.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/disk.py
    a b  
    262262        sage: type(d)
    263263        <type 'sage.plot.plot3d.index_face_set.IndexFaceSet'>
    264264
     265    Extra options will get passed on to show(), as long as they are valid::
     266
     267        sage: disk((0, 0), 5, (0, pi/2), xmin=0, xmax=5, ymin=0, ymax=5, figsize=(2,2), rgbcolor=(1, 0, 1))
     268        sage: disk((0, 0), 5, (0, pi/2), rgbcolor=(1, 0, 1)).show(xmin=0, xmax=5, ymin=0, ymax=5, figsize=(2,2)) # These are equivalent
     269
    265270    TESTS:
    266271
    267272    We cannot currently plot disks in more than three dimensions::
     
    273278    """
    274279    from sage.plot.plot import Graphics
    275280    g = Graphics()
     281    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    276282    g.add_primitive(Disk(point, radius, angle, options))
    277283    if len(point)==2:
    278284        return g
  • sage/plot/line.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/line.py
    a b  
    387387        sage: line([])
    388388        sage: line([(1,1)])
    389389
     390    Extra options will get passed on to show(), as long as they are valid::
     391   
     392        sage: line([(0,1), (3,4)], figsize=[10, 2])
     393        sage: line([(0,1), (3,4)]).show(figsize=[10, 2]) # These are equivalent
    390394    """
    391395    from sage.plot.plot import Graphics, xydata_from_point_list
    392396    xdata, ydata = xydata_from_point_list(points)
    393397    g = Graphics()
     398    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    394399    g.add_primitive(Line(xdata, ydata, options))
    395400    return g
  • sage/plot/matrix_plot.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/matrix_plot.py
    a b  
    5555        sage: M.options()
    5656        {'cmap': 'winter'}
    5757
     58    Extra options will get passed on to show(), as long as they are valid:
     59        sage: matrix_plot([[1, 0], [0, 1]], fontsize=10)
     60        sage: matrix_plot([[1, 0], [0, 1]]).show(fontsize=10) # These are equivalent
     61
     62    Extra options will get passed on to show(), as long as they are valid:
     63        sage: matrix_plot([[1, 0], [0, 1]], fontsize=10)
     64        sage: matrix_plot([[1, 0], [0, 1]]).show(fontsize=10) # These are equivalent
     65
    5866    TESTS:
    5967
    6068    We test creating a matrix plot::
     
    239247    yrange = (0, xy_data_array.shape[0])
    240248
    241249    g = Graphics()
     250    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    242251    g.add_primitive(MatrixPlot(xy_data_array, xrange, yrange, options))
    243252    return g
  • sage/plot/plot.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/plot.py
    a b  
    407407        self.__tick_label_color = (0, 0, 0)
    408408        self.__axes_width = 0.8
    409409        self.__objects = []
     410        self._extra_kwds = {}
    410411
    411412    def set_aspect_ratio(self, ratio):
    412413        """
     
    10311032       
    10321033        EXAMPLES::
    10331034       
    1034             sage: g1 = plot(abs(sqrt(x^3-1)), (x,1,5))
     1035            sage: g1 = plot(abs(sqrt(x^3-1)), (x,1,5), frame=True)
    10351036            sage: g2 = plot(-abs(sqrt(x^3-1)), (x,1,5), rgbcolor=(1,0,0))
    10361037            sage: g1 + g2  # displays the plot
     1038
     1039        TESTS::
     1040
     1041            sage: (g1 + g2)._extra_kwds # extra keywords to show are propagated
     1042            {'frame': True}
    10371043        """
    10381044        if isinstance(other, int) and other == 0:
    10391045            return self
     
    10451051        g = Graphics()
    10461052        g.__objects = self.__objects + other.__objects
    10471053        g.__aspect_ratio = max(self.__aspect_ratio, other.__aspect_ratio)
     1054        g._extra_kwds.update(self._extra_kwds)
     1055        g._extra_kwds.update(other._extra_kwds)
    10481056        return g
    10491057 
    10501058    def add_primitive(self, primitive):
     
    10821090            g = g.translate(0,0,z)
    10831091        return g
    10841092       
    1085     def show(self, xmin=None, xmax=None, ymin=None, ymax=None,
    1086              figsize=DEFAULT_FIGSIZE, filename=None,
    1087              dpi=DEFAULT_DPI, axes=None, axes_labels=None,frame=False,
    1088              fontsize=None, aspect_ratio=None,
    1089              gridlines=None, gridlinesstyle=None,
    1090              vgridlinesstyle=None, hgridlinesstyle=None, linkmode = False):
     1093    @classmethod
     1094    def _extract_kwds_for_show(cls, kwds, ignore=[]):
     1095        """
     1096        Extract keywords relevant to show() from the provided dictionary.
     1097
     1098        EXAMPLES::
     1099
     1100            sage: kwds = {'f': lambda x: x, 'xmin': 0, 'figsize': [1,1], 'plot_points': (40, 40)}
     1101            sage: G_kwds = Graphics._extract_kwds_for_show(kwds, ignore='xmin')
     1102            sage: kwds # Note how this action modifies the passed dictionary
     1103            {'xmin': 0, 'plot_points': (40, 40), 'f': <function <lambda> at ...>}
     1104            sage: G_kwds
     1105            {'figsize': [1, 1]}
     1106
     1107        This method is intended to be used with _set_extra_kwds(). Here is an
     1108        idiom to ensure the correct keywords will get passed on to show()::
     1109
     1110            sage: options = {} # Usually this will come from an argument
     1111            sage: g = Graphics()
     1112            sage: g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
     1113        """
     1114        result = {}
     1115        for option in cls.SHOW_OPTIONS:
     1116            if option not in ignore:
     1117                try:
     1118                    result[option] = kwds.pop(option)
     1119                except KeyError:
     1120                    pass
     1121        return result
     1122
     1123    def _set_extra_kwds(self, kwds):
     1124        """
     1125        Set a dictionary of keywords that will get passed on to show().
     1126
     1127        TESTS::
     1128
     1129            sage: g = Graphics()
     1130            sage: g._extra_kwds
     1131            {}
     1132            sage: g._set_extra_kwds({'figsize': [10,10]})
     1133            sage: g._extra_kwds
     1134            {'figsize': [10, 10]}
     1135            sage: g.show() # Now the (blank) plot will be extra large
     1136        """
     1137        self._extra_kwds = kwds
     1138
     1139    # This dictionary has the default values for the keywords to show(). When
     1140    # show is invoked with keyword arguments, those arguments are merged with
     1141    # this dictionary to create a set of keywords with the defaults filled in.
     1142    # Then, those keywords are passed on to save().
     1143
     1144    # NOTE: If you intend to use a new parameter in show(), you should update
     1145    # this dictionary to contain the default value for that parameter.
     1146
     1147    SHOW_OPTIONS = dict(xmin=None, xmax=None, ymin=None, ymax=None,
     1148                        figsize=DEFAULT_FIGSIZE, filename=None,
     1149                        dpi=DEFAULT_DPI, axes=None, axes_labels=None,frame=False,
     1150                        fontsize=None, aspect_ratio=None,
     1151                        gridlines=None, gridlinesstyle=None,
     1152                        vgridlinesstyle=None, hgridlinesstyle=None)
     1153
     1154    def show(self, **kwds):
    10911155        """
    10921156        Show this graphics image with the default image viewer.
    10931157
     
    12821346            sage: M = MatrixSpace(QQ,10).random_element()
    12831347            sage: matrix_plot(M).show(gridlines=True)
    12841348        """
     1349
     1350        # This option should not be passed on to save().
     1351        linkmode = kwds.pop('linkmode', False)
     1352
     1353        options = {}
     1354        options.update(self.SHOW_OPTIONS)
     1355        options.update(self._extra_kwds)
     1356        options.update(kwds)
     1357
    12851358        if DOCTEST_MODE:
    1286             self.save(DOCTEST_MODE_FILE,
    1287                       xmin, xmax, ymin, ymax, figsize,
    1288                       dpi=dpi, axes=axes, axes_labels=axes_labels,frame=frame,
    1289                       aspect_ratio=aspect_ratio, gridlines=gridlines,
    1290                       gridlinesstyle=gridlinesstyle,
    1291                       vgridlinesstyle=vgridlinesstyle,
    1292                       hgridlinesstyle=hgridlinesstyle)
    1293             return
    1294         if EMBEDDED_MODE:
    1295             if filename is None:
    1296                 filename = sage.misc.misc.graphics_filename()
    1297             self.save(filename, xmin, xmax, ymin, ymax, figsize,
    1298                       dpi=dpi, axes=axes, axes_labels=axes_labels,frame=frame,
    1299                       aspect_ratio=aspect_ratio, gridlines=gridlines,
    1300                       gridlinesstyle=gridlinesstyle,
    1301                       vgridlinesstyle=vgridlinesstyle,
    1302                       hgridlinesstyle=hgridlinesstyle)
     1359            options.pop('filename')
     1360            self.save(DOCTEST_MODE_FILE, **options)
     1361        elif EMBEDDED_MODE:
     1362            if options['filename'] is None:
     1363                options['filename'] = sage.misc.misc.graphics_filename()
     1364            self.save(**options)
    13031365            if linkmode == True:
    1304                 return "<img src='cell://%s'>"%filename
     1366                return "<img src='cell://%s'>" % options['filename']
    13051367            else:
    1306                 html("<img src='cell://%s'>"%filename)
    1307                 return
    1308         if filename is None:
    1309             filename = sage.misc.misc.tmp_filename() + '.png'
    1310         self.save(filename, xmin, xmax, ymin, ymax, figsize, dpi=dpi, axes=axes,
    1311                   axes_labels=axes_labels,
    1312                   frame=frame, fontsize=fontsize,
    1313                   aspect_ratio=aspect_ratio,
    1314                   gridlines=gridlines,
    1315                   gridlinesstyle=gridlinesstyle,
    1316                   vgridlinesstyle=vgridlinesstyle,
    1317                   hgridlinesstyle=hgridlinesstyle)
    1318         os.system('%s %s 2>/dev/null 1>/dev/null &'%(sage.misc.viewer.browser(), filename))
     1368                html("<img src='cell://%s'>" % options['filename'])
     1369        else:
     1370            if options['filename'] is None:
     1371                options['filename'] = sage.misc.misc.tmp_filename() + '.png'
     1372            self.save(**options)
     1373            os.system('%s %s 2>/dev/null 1>/dev/null &' % \
     1374                (sage.misc.viewer.browser(), options['filename']))
    13191375
    13201376    def xmin(self, xmin=None):
    13211377        """
     
    19301986        sage: def b(n): return lambda x: bessel_J(n, x) + 0.5*(n-1)
    19311987        sage: plot([b(c) for c in [1..5]], 0, 40, fill = dict([(i, [i+1]) for i in [0..3]]))
    19321988        sage: plot([b(c) for c in [1..5]], 0, 40, fill = dict([(i, i+1) for i in [0..3]]))
     1989   
     1990    Extra options will get passed on to show(), as long as they are valid::
     1991
     1992        sage: plot(sin(x^2), (x, -3, 3), figsize=[8,2])
     1993        sage: plot(sin(x^2), (x, -3, 3)).show(figsize=[8,2]) # These are equivalent
    19331994
    19341995    TESTS:
    19351996   
     
    19852046        ...
    19862047        RuntimeError: Error in line(): option 'foo' not valid.
    19872048    """
     2049    G_kwds = Graphics._extract_kwds_for_show(kwds, ignore=['xmin', 'xmax'])
     2050
    19882051    original_opts = kwds.pop('__original_opts', {})
    19892052    do_show = kwds.pop('show',False)
    19902053    if hasattr(funcs, 'plot'):
     
    20232086        else:
    20242087            sage.misc.misc.verbose("there were %s extra arguments (besides %s)" % (n, funcs), level=0)
    20252088
     2089    G._set_extra_kwds(G_kwds)
    20262090    if do_show:
    20272091        G.show()
    20282092    return G
  • sage/plot/plot_field.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/plot_field.py
    a b  
    155155        sage: x,y = var('x,y')
    156156        sage: plot_vector_field( (-x/sqrt(x^2+y^2), -y/sqrt(x^2+y^2)), (x, -10, 10), (y, -10, 10))
    157157        sage: plot_vector_field( (-x/sqrt(x+y), -y/sqrt(x+y)), (x, -10, 10), (y, -10, 10))
     158
     159    Extra options will get passed on to show(), as long as they are valid::
     160
     161        sage: plot_vector_field((x, y), (x, -2, 2), (y, -2, 2), xmax=10)
     162        sage: plot_vector_field((x, y), (x, -2, 2), (y, -2, 2)).show(xmax=10) # These are equivalent
    158163    """
    159164    from sage.plot.plot import setup_for_eval_on_grid, Graphics
    160165    z, xstep, ystep, xrange, yrange = setup_for_eval_on_grid([f,g], xrange, yrange, options['plot_points'])
     
    172177    xvec_array = numpy.ma.masked_invalid(numpy.array(xvec_array, dtype=float))
    173178    yvec_array = numpy.ma.masked_invalid(numpy.array(yvec_array, dtype=float))
    174179    g = Graphics()
     180    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    175181    g.add_primitive(PlotField(xpos_array, ypos_array, xvec_array, yvec_array, options))
    176182    return g
    177183
  • sage/plot/point.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/point.py
    a b  
    288288        sage: point((1,2,3))
    289289        sage: point([(0,0), (1,1)])
    290290        sage: point([(0,0,1), (1,1,1)])
    291         """
     291
     292    Extra options will get passed on to show(), as long as they are valid::
     293
     294        sage: point([(cos(theta), sin(theta)) for theta in srange(0, 2*pi, pi/8)], frame=True)
     295        sage: point([(cos(theta), sin(theta)) for theta in srange(0, 2*pi, pi/8)]).show(frame=True) # These are equivalent
     296    """
    292297    try:
    293298        return point2d(points, **kwds)
    294299    except (ValueError, TypeError):
     
    326331    Here are some random larger red points, given as a list of tuples::
    327332
    328333        sage: point(((0.5, 0.5), (1, 2), (0.5, 0.9), (-1, -1)), rgbcolor=hue(1), pointsize=30)
    329         """
     334
     335    Extra options will get passed on to show(), as long as they are valid::
     336
     337        sage: point([(cos(theta), sin(theta)) for theta in srange(0, 2*pi, pi/8)], frame=True)
     338        sage: point([(cos(theta), sin(theta)) for theta in srange(0, 2*pi, pi/8)]).show(frame=True) # These are equivalent
     339    """
    330340    from sage.plot.plot import xydata_from_point_list, Graphics
    331341    xdata, ydata = xydata_from_point_list(points)
    332342    g = Graphics()
     343    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    333344    g.add_primitive(Point(xdata, ydata, options))
    334345    return g
    335346
  • sage/plot/polygon.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/polygon.py
    a b  
    251251
    252252        sage: polygon([(0,0), (1,1), (0,1)])
    253253        sage: polygon([(0,0,1), (1,1,1), (2,0,1)])
     254
     255    Extra options will get passed on to show(), as long as they are valid:
     256        sage: polygon([(0,0), (1,1), (0,1)], axes=False)
     257        sage: polygon([(0,0), (1,1), (0,1)]).show(axes=False) # These are equivalent
    254258    """
    255259    try:
    256260        return polygon2d(points, **options)
     
    329333    from sage.plot.plot import xydata_from_point_list, Graphics
    330334    xdata, ydata = xydata_from_point_list(points)
    331335    g = Graphics()
     336    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    332337    g.add_primitive(Polygon(xdata, ydata, options))
    333338    return g
  • sage/plot/scatter_plot.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/scatter_plot.py
    a b  
    137137        sage: s = scatter_plot([[0,1],[2,2],[4.3,1.1]], marker='s')
    138138        sage: s
    139139       
     140    Extra options will get passed on to show(), as long as they are valid::
     141
     142        sage: scatter_plot([(0, 0), (1, 1)], markersize=100, facecolor='green', ymax=100)
     143        sage: scatter_plot([(0, 0), (1, 1)], markersize=100, facecolor='green').show(ymax=100) # These are equivalent
    140144    """
    141145    import numpy
    142146    from sage.plot.plot import Graphics
    143147    g = Graphics()
     148    g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
    144149    data = numpy.array(datalist, dtype='float')
    145150    if len(data) != 0:
    146151        xdata = data[:,0]
  • sage/plot/text.py

    diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/text.py
    a b  
    222222        ...
    223223        ValueError: use text3d instead for text in 3d
    224224        sage: t = text3d("hi",(1,2,3))
     225
     226    Extra options will get passed on to show(), as long as they are valid::
     227   
     228        sage: text("MATH IS AWESOME", (0, 0), fontsize=40, axes=False)
     229        sage: text("MATH IS AWESOME", (0, 0), fontsize=40).show(axes=False) # These are equivalent
    225230    """
    226231    try:
    227232        x, y = xy
     
    233238    options['rgbcolor'] = to_mpl_color(options['rgbcolor'])
    234239    point = (float(x), float(y))
    235240    g = Graphics()
     241    g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore='fontsize'))
    236242    g.add_primitive(Text(string, point, options))
    237243    return g