passagemath-plot 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-plot might be problematic. Click here for more details.
- passagemath_plot-10.6.31rc3.dist-info/METADATA +172 -0
- passagemath_plot-10.6.31rc3.dist-info/RECORD +78 -0
- passagemath_plot-10.6.31rc3.dist-info/WHEEL +5 -0
- passagemath_plot-10.6.31rc3.dist-info/top_level.txt +2 -0
- sage/all__sagemath_plot.py +15 -0
- sage/ext_data/threejs/animation.css +195 -0
- sage/ext_data/threejs/animation.html +85 -0
- sage/ext_data/threejs/animation.js +273 -0
- sage/ext_data/threejs/fat_lines.js +48 -0
- sage/ext_data/threejs/threejs-version.txt +1 -0
- sage/ext_data/threejs/threejs_template.html +597 -0
- sage/interfaces/all__sagemath_plot.py +1 -0
- sage/interfaces/gnuplot.py +196 -0
- sage/interfaces/jmoldata.py +208 -0
- sage/interfaces/povray.py +56 -0
- sage/plot/all.py +42 -0
- sage/plot/animate.py +1796 -0
- sage/plot/arc.py +504 -0
- sage/plot/arrow.py +671 -0
- sage/plot/bar_chart.py +205 -0
- sage/plot/bezier_path.py +400 -0
- sage/plot/circle.py +435 -0
- sage/plot/colors.py +1606 -0
- sage/plot/complex_plot.cpython-314-x86_64-linux-musl.so +0 -0
- sage/plot/complex_plot.pyx +1446 -0
- sage/plot/contour_plot.py +1792 -0
- sage/plot/density_plot.py +318 -0
- sage/plot/disk.py +373 -0
- sage/plot/ellipse.py +375 -0
- sage/plot/graphics.py +3580 -0
- sage/plot/histogram.py +354 -0
- sage/plot/hyperbolic_arc.py +404 -0
- sage/plot/hyperbolic_polygon.py +416 -0
- sage/plot/hyperbolic_regular_polygon.py +296 -0
- sage/plot/line.py +626 -0
- sage/plot/matrix_plot.py +629 -0
- sage/plot/misc.py +509 -0
- sage/plot/multigraphics.py +1294 -0
- sage/plot/plot.py +4183 -0
- sage/plot/plot3d/all.py +23 -0
- sage/plot/plot3d/base.cpython-314-x86_64-linux-musl.so +0 -0
- sage/plot/plot3d/base.pxd +12 -0
- sage/plot/plot3d/base.pyx +3378 -0
- sage/plot/plot3d/implicit_plot3d.py +659 -0
- sage/plot/plot3d/implicit_surface.cpython-314-x86_64-linux-musl.so +0 -0
- sage/plot/plot3d/implicit_surface.pyx +1453 -0
- sage/plot/plot3d/index_face_set.cpython-314-x86_64-linux-musl.so +0 -0
- sage/plot/plot3d/index_face_set.pxd +32 -0
- sage/plot/plot3d/index_face_set.pyx +1873 -0
- sage/plot/plot3d/introduction.py +131 -0
- sage/plot/plot3d/list_plot3d.py +649 -0
- sage/plot/plot3d/parametric_plot3d.py +1130 -0
- sage/plot/plot3d/parametric_surface.cpython-314-x86_64-linux-musl.so +0 -0
- sage/plot/plot3d/parametric_surface.pxd +12 -0
- sage/plot/plot3d/parametric_surface.pyx +893 -0
- sage/plot/plot3d/platonic.py +601 -0
- sage/plot/plot3d/plot3d.py +1442 -0
- sage/plot/plot3d/plot_field3d.py +162 -0
- sage/plot/plot3d/point_c.pxi +148 -0
- sage/plot/plot3d/revolution_plot3d.py +309 -0
- sage/plot/plot3d/shapes.cpython-314-x86_64-linux-musl.so +0 -0
- sage/plot/plot3d/shapes.pxd +22 -0
- sage/plot/plot3d/shapes.pyx +1382 -0
- sage/plot/plot3d/shapes2.py +1512 -0
- sage/plot/plot3d/tachyon.py +1779 -0
- sage/plot/plot3d/texture.py +453 -0
- sage/plot/plot3d/transform.cpython-314-x86_64-linux-musl.so +0 -0
- sage/plot/plot3d/transform.pxd +21 -0
- sage/plot/plot3d/transform.pyx +268 -0
- sage/plot/plot3d/tri_plot.py +589 -0
- sage/plot/plot_field.py +362 -0
- sage/plot/point.py +624 -0
- sage/plot/polygon.py +562 -0
- sage/plot/primitive.py +249 -0
- sage/plot/scatter_plot.py +199 -0
- sage/plot/step.py +85 -0
- sage/plot/streamline_plot.py +328 -0
- sage/plot/text.py +432 -0
sage/plot/ellipse.py
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-plot
|
|
2
|
+
"""
|
|
3
|
+
Ellipses
|
|
4
|
+
"""
|
|
5
|
+
# ****************************************************************************
|
|
6
|
+
# Copyright (C) 2010 Vincent Delecroix <20100.delecroix@gmail.com>
|
|
7
|
+
#
|
|
8
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
9
|
+
#
|
|
10
|
+
# This code is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
# General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# The full text of the GPL is available at:
|
|
16
|
+
#
|
|
17
|
+
# https://www.gnu.org/licenses/
|
|
18
|
+
# ****************************************************************************
|
|
19
|
+
|
|
20
|
+
from .primitive import GraphicPrimitive
|
|
21
|
+
from sage.misc.decorators import options, rename_keyword
|
|
22
|
+
from sage.plot.colors import to_mpl_color
|
|
23
|
+
from math import sin, cos, sqrt, pi, fmod
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Ellipse(GraphicPrimitive):
|
|
27
|
+
"""
|
|
28
|
+
Primitive class for the ``Ellipse`` graphics type. See ``ellipse?`` for
|
|
29
|
+
information about actually plotting ellipses.
|
|
30
|
+
|
|
31
|
+
INPUT:
|
|
32
|
+
|
|
33
|
+
- ``x``, ``y`` -- coordinates of the center of the ellipse
|
|
34
|
+
|
|
35
|
+
- ``r1``, ``r2`` -- radii of the ellipse
|
|
36
|
+
|
|
37
|
+
- ``angle`` -- angle
|
|
38
|
+
|
|
39
|
+
- ``options`` -- dictionary of options
|
|
40
|
+
|
|
41
|
+
EXAMPLES:
|
|
42
|
+
|
|
43
|
+
Note that this construction should be done using ``ellipse``::
|
|
44
|
+
|
|
45
|
+
sage: from math import pi
|
|
46
|
+
sage: from sage.plot.ellipse import Ellipse
|
|
47
|
+
sage: Ellipse(0, 0, 2, 1, pi/4, {})
|
|
48
|
+
Ellipse centered at (0.0, 0.0) with radii (2.0, 1.0) and angle 0.78539816339...
|
|
49
|
+
"""
|
|
50
|
+
def __init__(self, x, y, r1, r2, angle, options):
|
|
51
|
+
"""
|
|
52
|
+
Initialize base class ``Ellipse``.
|
|
53
|
+
|
|
54
|
+
TESTS::
|
|
55
|
+
|
|
56
|
+
sage: from sage.plot.ellipse import Ellipse
|
|
57
|
+
sage: e = Ellipse(0, 0, 1, 1, 0, {})
|
|
58
|
+
sage: print(loads(dumps(e)))
|
|
59
|
+
Ellipse centered at (0.0, 0.0) with radii (1.0, 1.0) and angle 0.0
|
|
60
|
+
sage: ellipse((0,0),0,1)
|
|
61
|
+
Traceback (most recent call last):
|
|
62
|
+
...
|
|
63
|
+
ValueError: both radii must be positive
|
|
64
|
+
"""
|
|
65
|
+
self.x = float(x)
|
|
66
|
+
self.y = float(y)
|
|
67
|
+
self.r1 = float(r1)
|
|
68
|
+
self.r2 = float(r2)
|
|
69
|
+
if self.r1 <= 0 or self.r2 <= 0:
|
|
70
|
+
raise ValueError("both radii must be positive")
|
|
71
|
+
self.angle = fmod(angle, 2 * pi)
|
|
72
|
+
if self.angle < 0:
|
|
73
|
+
self.angle += 2 * pi
|
|
74
|
+
GraphicPrimitive.__init__(self, options)
|
|
75
|
+
|
|
76
|
+
def get_minmax_data(self):
|
|
77
|
+
r"""
|
|
78
|
+
Return a dictionary with the bounding box data.
|
|
79
|
+
|
|
80
|
+
The bounding box is computed to be as minimal as possible.
|
|
81
|
+
|
|
82
|
+
EXAMPLES:
|
|
83
|
+
|
|
84
|
+
An example without an angle::
|
|
85
|
+
|
|
86
|
+
sage: p = ellipse((-2, 3), 1, 2)
|
|
87
|
+
sage: d = p.get_minmax_data()
|
|
88
|
+
sage: d['xmin']
|
|
89
|
+
-3.0
|
|
90
|
+
sage: d['xmax']
|
|
91
|
+
-1.0
|
|
92
|
+
sage: d['ymin']
|
|
93
|
+
1.0
|
|
94
|
+
sage: d['ymax']
|
|
95
|
+
5.0
|
|
96
|
+
|
|
97
|
+
The same example with a rotation of angle `\pi/2`::
|
|
98
|
+
|
|
99
|
+
sage: from math import pi
|
|
100
|
+
sage: p = ellipse((-2, 3), 1, 2, pi/2)
|
|
101
|
+
sage: d = p.get_minmax_data()
|
|
102
|
+
sage: d['xmin']
|
|
103
|
+
-4.0
|
|
104
|
+
sage: d['xmax']
|
|
105
|
+
0.0
|
|
106
|
+
sage: d['ymin']
|
|
107
|
+
2.0
|
|
108
|
+
sage: d['ymax']
|
|
109
|
+
4.0
|
|
110
|
+
"""
|
|
111
|
+
from sage.plot.plot import minmax_data
|
|
112
|
+
|
|
113
|
+
epsilon = 0.000001
|
|
114
|
+
cos_angle = cos(self.angle)
|
|
115
|
+
|
|
116
|
+
if abs(cos_angle) > 1-epsilon:
|
|
117
|
+
xmax = self.r1
|
|
118
|
+
ymax = self.r2
|
|
119
|
+
elif abs(cos_angle) < epsilon:
|
|
120
|
+
xmax = self.r2
|
|
121
|
+
ymax = self.r1
|
|
122
|
+
else:
|
|
123
|
+
sin_angle = sin(self.angle)
|
|
124
|
+
tan_angle = sin_angle / cos_angle
|
|
125
|
+
sxmax = ((self.r2*tan_angle)/self.r1)**2
|
|
126
|
+
symax = (self.r2/(self.r1*tan_angle))**2
|
|
127
|
+
xmax = (
|
|
128
|
+
abs(self.r1 * cos_angle / sqrt(sxmax+1.)) +
|
|
129
|
+
abs(self.r2 * sin_angle / sqrt(1./sxmax+1.)))
|
|
130
|
+
ymax = (
|
|
131
|
+
abs(self.r1 * sin_angle / sqrt(symax+1.)) +
|
|
132
|
+
abs(self.r2 * cos_angle / sqrt(1./symax+1.)))
|
|
133
|
+
|
|
134
|
+
return minmax_data([self.x - xmax, self.x + xmax],
|
|
135
|
+
[self.y - ymax, self.y + ymax],
|
|
136
|
+
dict=True)
|
|
137
|
+
|
|
138
|
+
def _allowed_options(self):
|
|
139
|
+
"""
|
|
140
|
+
Return the allowed options for the ``Ellipse`` class.
|
|
141
|
+
|
|
142
|
+
EXAMPLES::
|
|
143
|
+
|
|
144
|
+
sage: p = ellipse((3, 3), 2, 1)
|
|
145
|
+
sage: p[0]._allowed_options()['alpha']
|
|
146
|
+
'How transparent the figure is.'
|
|
147
|
+
sage: p[0]._allowed_options()['facecolor']
|
|
148
|
+
'2D only: The color of the face as an RGB tuple.'
|
|
149
|
+
"""
|
|
150
|
+
return {'alpha':'How transparent the figure is.',
|
|
151
|
+
'fill': 'Whether or not to fill the ellipse.',
|
|
152
|
+
'legend_label':'The label for this item in the legend.',
|
|
153
|
+
'legend_color':'The color of the legend text.',
|
|
154
|
+
'thickness':'How thick the border of the ellipse is.',
|
|
155
|
+
'edgecolor':'2D only: The color of the edge as an RGB tuple.',
|
|
156
|
+
'facecolor':'2D only: The color of the face as an RGB tuple.',
|
|
157
|
+
'rgbcolor':'The color (edge and face) as an RGB tuple.',
|
|
158
|
+
'hue':'The color given as a hue.',
|
|
159
|
+
'zorder':'2D only: The layer level in which to draw',
|
|
160
|
+
'linestyle':"2D only: The style of the line, which is one of "
|
|
161
|
+
"'dashed', 'dotted', 'solid', 'dashdot', or '--', ':', '-', '-.', "
|
|
162
|
+
"respectively."}
|
|
163
|
+
|
|
164
|
+
def _repr_(self):
|
|
165
|
+
"""
|
|
166
|
+
String representation of ``Ellipse`` primitive.
|
|
167
|
+
|
|
168
|
+
TESTS::
|
|
169
|
+
|
|
170
|
+
sage: from sage.plot.ellipse import Ellipse
|
|
171
|
+
sage: Ellipse(0,0,2,1,0,{})._repr_()
|
|
172
|
+
'Ellipse centered at (0.0, 0.0) with radii (2.0, 1.0) and angle 0.0'
|
|
173
|
+
"""
|
|
174
|
+
return "Ellipse centered at ({}, {}) with radii ({}, {}) and angle {}".format(self.x, self.y, self.r1, self.r2, self.angle)
|
|
175
|
+
|
|
176
|
+
def _render_on_subplot(self, subplot):
|
|
177
|
+
"""
|
|
178
|
+
Render this ellipse in a subplot. This is the key function that
|
|
179
|
+
defines how this ellipse graphics primitive is rendered in matplotlib's
|
|
180
|
+
library.
|
|
181
|
+
|
|
182
|
+
TESTS::
|
|
183
|
+
|
|
184
|
+
sage: from math import pi
|
|
185
|
+
sage: ellipse((0,0),3,1,pi/6,fill=True,alpha=0.3)
|
|
186
|
+
Graphics object consisting of 1 graphics primitive
|
|
187
|
+
|
|
188
|
+
::
|
|
189
|
+
|
|
190
|
+
sage: ellipse((3,2),1,2)
|
|
191
|
+
Graphics object consisting of 1 graphics primitive
|
|
192
|
+
"""
|
|
193
|
+
import matplotlib.patches as patches
|
|
194
|
+
from sage.plot.misc import get_matplotlib_linestyle
|
|
195
|
+
|
|
196
|
+
options = self.options()
|
|
197
|
+
p = patches.Ellipse(
|
|
198
|
+
(self.x,self.y),
|
|
199
|
+
self.r1*2.,self.r2*2.,
|
|
200
|
+
angle=self.angle/pi*180.)
|
|
201
|
+
p.set_linewidth(float(options['thickness']))
|
|
202
|
+
p.set_fill(options['fill'])
|
|
203
|
+
a = float(options['alpha'])
|
|
204
|
+
p.set_alpha(a)
|
|
205
|
+
ec = to_mpl_color(options['edgecolor'])
|
|
206
|
+
fc = to_mpl_color(options['facecolor'])
|
|
207
|
+
if 'rgbcolor' in options:
|
|
208
|
+
ec = fc = to_mpl_color(options['rgbcolor'])
|
|
209
|
+
p.set_edgecolor(ec)
|
|
210
|
+
p.set_facecolor(fc)
|
|
211
|
+
p.set_linestyle(get_matplotlib_linestyle(options['linestyle'],return_type='long'))
|
|
212
|
+
p.set_label(options['legend_label'])
|
|
213
|
+
z = int(options.pop('zorder', 0))
|
|
214
|
+
p.set_zorder(z)
|
|
215
|
+
subplot.add_patch(p)
|
|
216
|
+
|
|
217
|
+
def plot3d(self):
|
|
218
|
+
r"""
|
|
219
|
+
Plotting in 3D is not implemented.
|
|
220
|
+
|
|
221
|
+
TESTS::
|
|
222
|
+
|
|
223
|
+
sage: from sage.plot.ellipse import Ellipse
|
|
224
|
+
sage: Ellipse(0,0,2,1,pi/4,{}).plot3d() # needs sage.symbolic
|
|
225
|
+
Traceback (most recent call last):
|
|
226
|
+
...
|
|
227
|
+
NotImplementedError
|
|
228
|
+
"""
|
|
229
|
+
raise NotImplementedError
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@rename_keyword(color='rgbcolor')
|
|
233
|
+
@options(alpha=1, fill=False, thickness=1, edgecolor='blue', facecolor='blue', linestyle='solid', zorder=5,
|
|
234
|
+
aspect_ratio=1.0, legend_label=None, legend_color=None)
|
|
235
|
+
def ellipse(center, r1, r2, angle=0, **options):
|
|
236
|
+
"""
|
|
237
|
+
Return an ellipse centered at a point center = ``(x,y)`` with radii =
|
|
238
|
+
``r1,r2`` and angle ``angle``. Type ``ellipse.options`` to see all
|
|
239
|
+
options.
|
|
240
|
+
|
|
241
|
+
INPUT:
|
|
242
|
+
|
|
243
|
+
- ``center`` -- 2-tuple of real numbers; coordinates of the center
|
|
244
|
+
|
|
245
|
+
- ``r1``, ``r2`` -- positive real numbers; the radii of the ellipse
|
|
246
|
+
|
|
247
|
+
- ``angle`` -- real number (default: 0) -- the angle between the first axis
|
|
248
|
+
and the horizontal
|
|
249
|
+
|
|
250
|
+
OPTIONS:
|
|
251
|
+
|
|
252
|
+
- ``alpha`` -- (default: 1) transparency
|
|
253
|
+
|
|
254
|
+
- ``fill`` -- (default: ``False``) whether to fill the ellipse or not
|
|
255
|
+
|
|
256
|
+
- ``thickness`` -- (default: 1) thickness of the line
|
|
257
|
+
|
|
258
|
+
- ``linestyle`` -- (default: ``'solid'``) the style of the line, which is one
|
|
259
|
+
of ``'dashed'``, ``'dotted'``, ``'solid'``, ``'dashdot'``, or ``'--'``,
|
|
260
|
+
``':'``, ``'-'``, ``'-.'``, respectively
|
|
261
|
+
|
|
262
|
+
- ``edgecolor`` -- (default: ``'black'``) color of the contour
|
|
263
|
+
|
|
264
|
+
- ``facecolor`` -- (default: ``'red'``) color of the filling
|
|
265
|
+
|
|
266
|
+
- ``rgbcolor`` -- 2D or 3D plotting. This option overrides
|
|
267
|
+
``edgecolor`` and ``facecolor`` for 2D plotting
|
|
268
|
+
|
|
269
|
+
- ``legend_label`` -- the label for this item in the legend
|
|
270
|
+
|
|
271
|
+
- ``legend_color`` -- the color for the legend label
|
|
272
|
+
|
|
273
|
+
EXAMPLES:
|
|
274
|
+
|
|
275
|
+
An ellipse centered at (0,0) with major and minor axes of lengths 2 and 1.
|
|
276
|
+
Note that the default color is blue::
|
|
277
|
+
|
|
278
|
+
sage: ellipse((0,0),2,1)
|
|
279
|
+
Graphics object consisting of 1 graphics primitive
|
|
280
|
+
|
|
281
|
+
.. PLOT::
|
|
282
|
+
|
|
283
|
+
E=ellipse((0,0),2,1)
|
|
284
|
+
sphinx_plot(E)
|
|
285
|
+
|
|
286
|
+
More complicated examples with tilted axes and drawing options::
|
|
287
|
+
|
|
288
|
+
sage: from math import pi
|
|
289
|
+
sage: ellipse((0,0), 3, 1, pi/6, fill=True, alpha=0.3, linestyle='dashed')
|
|
290
|
+
Graphics object consisting of 1 graphics primitive
|
|
291
|
+
|
|
292
|
+
.. PLOT::
|
|
293
|
+
|
|
294
|
+
E = ellipse((0,0),3,1,pi/6,fill=True,alpha=0.3,linestyle='dashed')
|
|
295
|
+
sphinx_plot(E)
|
|
296
|
+
|
|
297
|
+
other way to indicate dashed linestyle::
|
|
298
|
+
|
|
299
|
+
sage: ellipse((0,0),3,1,pi/6,fill=True,alpha=0.3,linestyle='--')
|
|
300
|
+
Graphics object consisting of 1 graphics primitive
|
|
301
|
+
|
|
302
|
+
.. PLOT::
|
|
303
|
+
|
|
304
|
+
E =ellipse((0,0),3,1,pi/6,fill=True,alpha=0.3,linestyle='--')
|
|
305
|
+
sphinx_plot(E)
|
|
306
|
+
|
|
307
|
+
with colors ::
|
|
308
|
+
|
|
309
|
+
sage: ellipse((0,0),3,1,pi/6,fill=True,edgecolor='black',facecolor='red')
|
|
310
|
+
Graphics object consisting of 1 graphics primitive
|
|
311
|
+
|
|
312
|
+
.. PLOT::
|
|
313
|
+
|
|
314
|
+
E=ellipse((0,0),3,1,pi/6,fill=True,edgecolor='black',facecolor='red')
|
|
315
|
+
sphinx_plot(E)
|
|
316
|
+
|
|
317
|
+
We see that ``rgbcolor`` overrides these other options, as this plot
|
|
318
|
+
is green::
|
|
319
|
+
|
|
320
|
+
sage: ellipse((0,0),3,1,pi/6,fill=True,edgecolor='black',facecolor='red',rgbcolor='green')
|
|
321
|
+
Graphics object consisting of 1 graphics primitive
|
|
322
|
+
|
|
323
|
+
.. PLOT::
|
|
324
|
+
|
|
325
|
+
E=ellipse((0,0),3,1,pi/6,fill=True,edgecolor='black',facecolor='red',rgbcolor='green')
|
|
326
|
+
sphinx_plot(E)
|
|
327
|
+
|
|
328
|
+
The default aspect ratio for ellipses is 1.0::
|
|
329
|
+
|
|
330
|
+
sage: ellipse((0,0),2,1).aspect_ratio()
|
|
331
|
+
1.0
|
|
332
|
+
|
|
333
|
+
One cannot yet plot ellipses in 3D::
|
|
334
|
+
|
|
335
|
+
sage: ellipse((0,0,0),2,1)
|
|
336
|
+
Traceback (most recent call last):
|
|
337
|
+
...
|
|
338
|
+
NotImplementedError: plotting ellipse in 3D is not implemented
|
|
339
|
+
|
|
340
|
+
We can also give ellipses a legend::
|
|
341
|
+
|
|
342
|
+
sage: ellipse((0,0),2,1,legend_label="My ellipse", legend_color='green')
|
|
343
|
+
Graphics object consisting of 1 graphics primitive
|
|
344
|
+
|
|
345
|
+
.. PLOT::
|
|
346
|
+
|
|
347
|
+
E=ellipse((0,0),2,1,legend_label="My ellipse", legend_color='green')
|
|
348
|
+
sphinx_plot(E)
|
|
349
|
+
|
|
350
|
+
TESTS:
|
|
351
|
+
|
|
352
|
+
Verify that :issue:`36153` does not arise::
|
|
353
|
+
|
|
354
|
+
sage: E = ellipse((0,0), 2, 1, legend_label='test')
|
|
355
|
+
"""
|
|
356
|
+
from sage.plot.all import Graphics
|
|
357
|
+
g = Graphics()
|
|
358
|
+
|
|
359
|
+
# Reset aspect_ratio to 'automatic' in case scale is 'semilog[xy]'.
|
|
360
|
+
# Otherwise matplotlib complains.
|
|
361
|
+
scale = options.get('scale', None)
|
|
362
|
+
if isinstance(scale, (list, tuple)):
|
|
363
|
+
scale = scale[0]
|
|
364
|
+
if scale == 'semilogy' or scale == 'semilogx':
|
|
365
|
+
options['aspect_ratio'] = 'automatic'
|
|
366
|
+
|
|
367
|
+
g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
|
|
368
|
+
g.add_primitive(Ellipse(center[0],center[1],r1,r2,angle,options))
|
|
369
|
+
if options['legend_label']:
|
|
370
|
+
g.legend(True)
|
|
371
|
+
g._legend_colors = [options['legend_color']]
|
|
372
|
+
if len(center) == 2:
|
|
373
|
+
return g
|
|
374
|
+
elif len(center) == 3:
|
|
375
|
+
raise NotImplementedError("plotting ellipse in 3D is not implemented")
|