Ticket #5651: trac5651-rebase.patch
File trac5651-rebase.patch, 22.5 KB (added by , 14 years ago) |
---|
-
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 378 378 379 379 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)) 380 380 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) 381 385 """ 382 386 from sage.plot.plot import Graphics 383 387 g = Graphics() 388 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 384 389 if headpoint is not None and tailpoint is not None: 385 390 xtail, ytail = tailpoint 386 391 xhead, yhead = headpoint -
sage/plot/bar_chart.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/bar_chart.py
a b 127 127 A bar_chart with negative values and red bars:: 128 128 129 129 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 130 134 """ 131 135 dl = len(datalist) 132 136 #if dl > 1: … … 142 146 #cnt += 1 143 147 144 148 g = Graphics() 149 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 145 150 #TODO: improve below for multiple data sets! 146 151 #cnt = 1 147 152 #for ind, pnts, xrange, yrange in bardata: -
sage/plot/bezier_path.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/bezier_path.py
a b 167 167 sage: path = [[(0,0),(.5,1),(1,0)]] 168 168 sage: curve = bezier_path(path, linestyle='dashed', rgbcolor='green') 169 169 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 170 175 """ 171 176 from sage.plot.plot import Graphics 172 177 g = Graphics() 178 g._set_extra_kwds(g._extract_kwds_for_show(options)) 173 179 g.add_primitive(BezierPath(path, options)) 174 180 return g 175 181 -
sage/plot/circle.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/circle.py
a b 275 275 276 276 sage: C = circle((2,3), 1, fill=True, edgecolor='blue', rgbcolor='green', hue=.8) 277 277 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 278 283 TESTS: 279 284 280 285 We cannot currently plot circles in more than three dimensions:: … … 286 291 """ 287 292 from sage.plot.plot import Graphics 288 293 g = Graphics() 294 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 289 295 g.add_primitive(Circle(center[0], center[1], radius, options)) 290 296 if len(center)==2: 291 297 return g -
sage/plot/complex_plot.pyx
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/complex_plot.pyx
a b 276 276 The Riemann Zeta function:: 277 277 278 278 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 279 284 """ 280 285 from sage.plot.plot import Graphics, setup_for_eval_on_grid 281 286 cdef double x, y … … 289 294 for y in yrange_list] 290 295 _sig_off 291 296 g = Graphics() 297 g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) 292 298 g.add_primitive(ComplexPlot(z_values, xrange, yrange, options)) 293 299 return g -
sage/plot/contour_plot.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/contour_plot.py
a b 241 241 242 242 sage: x,y = var('x,y') 243 243 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 244 250 """ 245 251 from sage.plot.plot import Graphics, setup_for_eval_on_grid 246 252 g, xstep, ystep, xrange, yrange = setup_for_eval_on_grid([f], xrange, yrange, options['plot_points']) … … 249 255 for y in xsrange(yrange[0], yrange[1], ystep, include_endpoint=True)] 250 256 251 257 g = Graphics() 258 g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) 252 259 g.add_primitive(ContourPlot(xy_data_array, xrange, yrange, options)) 253 260 return g 254 261 -
sage/plot/density_plot.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/density_plot.py
a b 209 209 210 210 sage: density_plot(y^2 + 1 - x^3 - x, (y,-pi,pi), (x,-pi,pi)) 211 211 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 212 217 """ 213 218 from sage.plot.plot import Graphics, setup_for_eval_on_grid 214 219 g, xstep, ystep, xrange, yrange = setup_for_eval_on_grid([f], xrange, yrange, options['plot_points']) … … 217 222 for y in xsrange(yrange[0], yrange[1], ystep, include_endpoint=True)] 218 223 219 224 g = Graphics() 225 g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax'])) 220 226 g.add_primitive(DensityPlot(xy_data_array, xrange, yrange, options)) 221 227 return g -
sage/plot/disk.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/disk.py
a b 262 262 sage: type(d) 263 263 <type 'sage.plot.plot3d.index_face_set.IndexFaceSet'> 264 264 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 265 270 TESTS: 266 271 267 272 We cannot currently plot disks in more than three dimensions:: … … 273 278 """ 274 279 from sage.plot.plot import Graphics 275 280 g = Graphics() 281 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 276 282 g.add_primitive(Disk(point, radius, angle, options)) 277 283 if len(point)==2: 278 284 return g -
sage/plot/line.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/line.py
a b 387 387 sage: line([]) 388 388 sage: line([(1,1)]) 389 389 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 390 394 """ 391 395 from sage.plot.plot import Graphics, xydata_from_point_list 392 396 xdata, ydata = xydata_from_point_list(points) 393 397 g = Graphics() 398 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 394 399 g.add_primitive(Line(xdata, ydata, options)) 395 400 return g -
sage/plot/matrix_plot.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/matrix_plot.py
a b 55 55 sage: M.options() 56 56 {'cmap': 'winter'} 57 57 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 58 66 TESTS: 59 67 60 68 We test creating a matrix plot:: … … 239 247 yrange = (0, xy_data_array.shape[0]) 240 248 241 249 g = Graphics() 250 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 242 251 g.add_primitive(MatrixPlot(xy_data_array, xrange, yrange, options)) 243 252 return g -
sage/plot/plot.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/plot.py
a b 407 407 self.__tick_label_color = (0, 0, 0) 408 408 self.__axes_width = 0.8 409 409 self.__objects = [] 410 self._extra_kwds = {} 410 411 411 412 def set_aspect_ratio(self, ratio): 412 413 """ … … 1031 1032 1032 1033 EXAMPLES:: 1033 1034 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) 1035 1036 sage: g2 = plot(-abs(sqrt(x^3-1)), (x,1,5), rgbcolor=(1,0,0)) 1036 1037 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} 1037 1043 """ 1038 1044 if isinstance(other, int) and other == 0: 1039 1045 return self … … 1045 1051 g = Graphics() 1046 1052 g.__objects = self.__objects + other.__objects 1047 1053 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) 1048 1056 return g 1049 1057 1050 1058 def add_primitive(self, primitive): … … 1082 1090 g = g.translate(0,0,z) 1083 1091 return g 1084 1092 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): 1091 1155 """ 1092 1156 Show this graphics image with the default image viewer. 1093 1157 … … 1282 1346 sage: M = MatrixSpace(QQ,10).random_element() 1283 1347 sage: matrix_plot(M).show(gridlines=True) 1284 1348 """ 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 1285 1358 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) 1303 1365 if linkmode == True: 1304 return "<img src='cell://%s'>" %filename1366 return "<img src='cell://%s'>" % options['filename'] 1305 1367 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'])) 1319 1375 1320 1376 def xmin(self, xmin=None): 1321 1377 """ … … 1930 1986 sage: def b(n): return lambda x: bessel_J(n, x) + 0.5*(n-1) 1931 1987 sage: plot([b(c) for c in [1..5]], 0, 40, fill = dict([(i, [i+1]) for i in [0..3]])) 1932 1988 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 1933 1994 1934 1995 TESTS: 1935 1996 … … 1985 2046 ... 1986 2047 RuntimeError: Error in line(): option 'foo' not valid. 1987 2048 """ 2049 G_kwds = Graphics._extract_kwds_for_show(kwds, ignore=['xmin', 'xmax']) 2050 1988 2051 original_opts = kwds.pop('__original_opts', {}) 1989 2052 do_show = kwds.pop('show',False) 1990 2053 if hasattr(funcs, 'plot'): … … 2023 2086 else: 2024 2087 sage.misc.misc.verbose("there were %s extra arguments (besides %s)" % (n, funcs), level=0) 2025 2088 2089 G._set_extra_kwds(G_kwds) 2026 2090 if do_show: 2027 2091 G.show() 2028 2092 return G -
sage/plot/plot_field.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/plot_field.py
a b 155 155 sage: x,y = var('x,y') 156 156 sage: plot_vector_field( (-x/sqrt(x^2+y^2), -y/sqrt(x^2+y^2)), (x, -10, 10), (y, -10, 10)) 157 157 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 158 163 """ 159 164 from sage.plot.plot import setup_for_eval_on_grid, Graphics 160 165 z, xstep, ystep, xrange, yrange = setup_for_eval_on_grid([f,g], xrange, yrange, options['plot_points']) … … 172 177 xvec_array = numpy.ma.masked_invalid(numpy.array(xvec_array, dtype=float)) 173 178 yvec_array = numpy.ma.masked_invalid(numpy.array(yvec_array, dtype=float)) 174 179 g = Graphics() 180 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 175 181 g.add_primitive(PlotField(xpos_array, ypos_array, xvec_array, yvec_array, options)) 176 182 return g 177 183 -
sage/plot/point.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/point.py
a b 288 288 sage: point((1,2,3)) 289 289 sage: point([(0,0), (1,1)]) 290 290 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 """ 292 297 try: 293 298 return point2d(points, **kwds) 294 299 except (ValueError, TypeError): … … 326 331 Here are some random larger red points, given as a list of tuples:: 327 332 328 333 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 """ 330 340 from sage.plot.plot import xydata_from_point_list, Graphics 331 341 xdata, ydata = xydata_from_point_list(points) 332 342 g = Graphics() 343 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 333 344 g.add_primitive(Point(xdata, ydata, options)) 334 345 return g 335 346 -
sage/plot/polygon.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/polygon.py
a b 251 251 252 252 sage: polygon([(0,0), (1,1), (0,1)]) 253 253 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 254 258 """ 255 259 try: 256 260 return polygon2d(points, **options) … … 329 333 from sage.plot.plot import xydata_from_point_list, Graphics 330 334 xdata, ydata = xydata_from_point_list(points) 331 335 g = Graphics() 336 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 332 337 g.add_primitive(Polygon(xdata, ydata, options)) 333 338 return g -
sage/plot/scatter_plot.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/scatter_plot.py
a b 137 137 sage: s = scatter_plot([[0,1],[2,2],[4.3,1.1]], marker='s') 138 138 sage: s 139 139 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 140 144 """ 141 145 import numpy 142 146 from sage.plot.plot import Graphics 143 147 g = Graphics() 148 g._set_extra_kwds(Graphics._extract_kwds_for_show(options)) 144 149 data = numpy.array(datalist, dtype='float') 145 150 if len(data) != 0: 146 151 xdata = data[:,0] -
sage/plot/text.py
diff -r f19f590fa74a -r 590a3f0bef54 sage/plot/text.py
a b 222 222 ... 223 223 ValueError: use text3d instead for text in 3d 224 224 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 225 230 """ 226 231 try: 227 232 x, y = xy … … 233 238 options['rgbcolor'] = to_mpl_color(options['rgbcolor']) 234 239 point = (float(x), float(y)) 235 240 g = Graphics() 241 g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore='fontsize')) 236 242 g.add_primitive(Text(string, point, options)) 237 243 return g