Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit ff6eb09

Browse files
committed
Name of argument 'nb_values' in RealChart.plot changed to 'number_values'.
1 parent b4a4530 commit ff6eb09

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

src/sage/manifolds/chart.py

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ def valid_coordinates(self, *coordinates, **kwds):
18661866
@options(max_range=8, color='red', style='-', thickness=1, plot_points=75,
18671867
label_axes=True)
18681868
def plot(self, chart=None, ambient_coords=None, mapping=None,
1869-
fixed_coords=None, ranges=None, nb_values=None,
1869+
fixed_coords=None, ranges=None, number_values=None,
18701870
steps=None, parameters=None, **kwds):
18711871
r"""
18721872
Plot ``self`` as a grid in a Cartesian graph based on
@@ -1907,16 +1907,16 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
19071907
entire coordinate range declared during the chart construction
19081908
is considered (with ``-Infinity`` replaced by ``-max_range``
19091909
and ``+Infinity`` by ``max_range``)
1910-
- ``nb_values`` -- (default: ``None``) either an integer or a dictionary
1911-
with keys the coordinates to be drawn and values the number of
1912-
constant values of the coordinate to be considered; if ``nb_values``
1913-
is a single integer, it represents the number of constant values for
1914-
all coordinates; if ``nb_values`` is ``None``, it is set to 9 for a
1915-
2D plot and to 5 for a 3D plot
1910+
- ``number_values`` -- (default: ``None``) either an integer or a
1911+
dictionary with keys the coordinates to be drawn and values the
1912+
number of constant values of the coordinate to be considered; if
1913+
``number_values`` is a single integer, it represents the number of
1914+
constant values for all coordinates; if ``number_values`` is ``None``,
1915+
it is set to 9 for a 2D plot and to 5 for a 3D plot
19161916
- ``steps`` -- (default: ``None``) dictionary with keys the coordinates
19171917
to be drawn and values the step between each constant value of
19181918
the coordinate; if ``None``, the step is computed from the coordinate
1919-
range (specified in ``ranges``) and ``nb_values``. On the contrary
1919+
range (specified in ``ranges``) and ``number_values``. On the contrary
19201920
if the step is provided for some coordinate, the corresponding
19211921
number of constant values is deduced from it and the coordinate range.
19221922
- ``parameters`` -- (default: ``None``) dictionary giving the numerical
@@ -2001,8 +2001,10 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
20012001
20022002
Call with non-default values::
20032003
2004-
sage: g = c_pol.plot(c_cart, ranges={ph:(pi/4,pi)}, nb_values={r:7, ph:17},
2005-
....: color={r:'red', ph:'green'}, style={r:'-', ph:'--'})
2004+
sage: g = c_pol.plot(c_cart, ranges={ph:(pi/4,pi)},
2005+
....: number_values={r:7, ph:17},
2006+
....: color={r:'red', ph:'green'},
2007+
....: style={r:'-', ph:'--'})
20062008
20072009
.. PLOT::
20082010
@@ -2011,7 +2013,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
20112013
U = R2.open_subset('U', coord_def={c_cart: (y!=0, x<0)})
20122014
c_pol = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi'); r, ph = c_pol[:]
20132015
pol_to_cart = c_pol.transition_map(c_cart, [r*cos(ph), r*sin(ph)])
2014-
g = c_pol.plot(c_cart, ranges={ph:(pi/4,pi)}, nb_values={r:7, ph:17}, \
2016+
g = c_pol.plot(c_cart, ranges={ph:(pi/4,pi)}, number_values={r:7, ph:17},
20152017
color={r:'red', ph:'green'}, style={r:'-', ph:'--'})
20162018
sphinx_plot(g)
20172019
@@ -2089,9 +2091,9 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
20892091
sphinx_plot(c_xy.plot(c_cart, mapping=Phi))
20902092
20912093
NB: to get a better coverage of the whole sphere, one should increase
2092-
the coordinate sampling via the argument ``nb_values`` or the
2093-
argument ``steps`` (only the default value, ``nb_values = 5``, is used
2094-
here, which is pretty low).
2094+
the coordinate sampling via the argument ``number_values`` or the
2095+
argument ``steps`` (only the default value, ``number_values = 5``, is
2096+
used here, which is pretty low).
20952097
20962098
The same plot without the ``(X,Y,Z)`` axes labels::
20972099
@@ -2142,8 +2144,8 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
21422144
U = S2.open_subset('U'); V = S2.open_subset('V'); S2.declare_union(U,V)
21432145
c_xy = U.chart('x y'); x, y = c_xy[:]
21442146
c_uv = V.chart('u v'); u, v = c_uv[:]
2145-
xy_to_uv = c_xy.transition_map(c_uv, (x/(x**2+y**2), y/(x**2+y**2)), \
2146-
intersection_name='W', restrictions1= x**2+y**2!=0, \
2147+
xy_to_uv = c_xy.transition_map(c_uv, (x/(x**2+y**2), y/(x**2+y**2)),
2148+
intersection_name='W', restrictions1= x**2+y**2!=0,
21472149
restrictions2= u**2+v**2!=0)
21482150
uv_to_xy = xy_to_uv.inverse()
21492151
c_uvW = c_uv.restrict(U.intersection(V))
@@ -2168,13 +2170,14 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
21682170
U = S2.open_subset('U'); V = S2.open_subset('V'); S2.declare_union(U,V)
21692171
c_xy = U.chart('x y'); x, y = c_xy[:]
21702172
c_uv = V.chart('u v'); u, v = c_uv[:]
2171-
xy_to_uv = c_xy.transition_map(c_uv, (x/(x**2+y**2), y/(x**2+y**2)), \
2172-
intersection_name='W', restrictions1= x**2+y**2!=0, \
2173+
xy_to_uv = c_xy.transition_map(c_uv, (x/(x**2+y**2), y/(x**2+y**2)),
2174+
intersection_name='W', restrictions1= x**2+y**2!=0,
21732175
restrictions2= u**2+v**2!=0)
21742176
uv_to_xy = xy_to_uv.inverse()
21752177
c_uvW = c_uv.restrict(U.intersection(V))
21762178
gu1 = c_uvW.plot(c_xy, fixed_coords={u: 1}, max_range=20, plot_points=300)
2177-
gv1 = c_uvW.plot(c_xy, fixed_coords={v: 1}, max_range=20, plot_points=300, color='green')
2179+
gv1 = c_uvW.plot(c_xy, fixed_coords={v: 1}, max_range=20, plot_points=300,
2180+
color='green')
21782181
sphinx_plot(gu1+gv1)
21792182
21802183
Note that we have set ``max_range=20`` to have a wider range for
@@ -2255,7 +2258,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
22552258
plot_points = kwds['plot_points']
22562259
label_axes = kwds['label_axes']
22572260

2258-
def _plot_xx_list(xx_list, rem_coords, ranges, steps, nb_values):
2261+
def _plot_xx_list(xx_list, rem_coords, ranges, steps, number_values):
22592262
r"""
22602263
Helper function to plot the coordinate grid.
22612264
"""
@@ -2265,7 +2268,7 @@ def _plot_xx_list(xx_list, rem_coords, ranges, steps, nb_values):
22652268
resu = []
22662269
for xx in xx_list:
22672270
xc = xmin
2268-
for i in range(nb_values[coord]):
2271+
for i in range(number_values[coord]):
22692272
nxx = list(xx)
22702273
nxx[self._xx.index(coord)] = xc
22712274
resu.append(nxx)
@@ -2275,7 +2278,7 @@ def _plot_xx_list(xx_list, rem_coords, ranges, steps, nb_values):
22752278
else:
22762279
rem_coords.remove(coord)
22772280
return _plot_xx_list(resu, rem_coords, ranges, steps,
2278-
nb_values)
2281+
number_values)
22792282

22802283
if chart is None:
22812284
chart = self
@@ -2374,25 +2377,25 @@ def _plot_xx_list(xx_list, rem_coords, ranges, steps, nb_values):
23742377
xmax = numerical_approx(bounds[1][0] - 1.e-3)
23752378
ranges0[coord] = (xmin, xmax)
23762379
ranges = ranges0
2377-
if nb_values is None:
2380+
if number_values is None:
23782381
if nca == 2: # 2D plot
2379-
nb_values = 9
2382+
number_values = 9
23802383
else: # 3D plot
2381-
nb_values = 5
2382-
if not isinstance(nb_values, dict):
2383-
nb_values0 = {}
2384+
number_values = 5
2385+
if not isinstance(number_values, dict):
2386+
number_values0 = {}
23842387
for coord in coords:
2385-
nb_values0[coord] = nb_values
2386-
nb_values = nb_values0
2388+
number_values0[coord] = number_values
2389+
number_values = number_values0
23872390
if steps is None:
23882391
steps = {}
23892392
for coord in coords:
23902393
if coord not in steps:
23912394
steps[coord] = ((ranges[coord][1] - ranges[coord][0])
2392-
/ (nb_values[coord]-1))
2395+
/ (number_values[coord]-1))
23932396
else:
23942397
from sage.functions.other import floor
2395-
nb_values[coord] = 1 + floor((ranges[coord][1] - ranges[coord][0])
2398+
number_values[coord] = 1 + floor((ranges[coord][1] - ranges[coord][0])
23962399
/ steps[coord])
23972400
if not isinstance(color, dict):
23982401
color0 = {}
@@ -2433,7 +2436,7 @@ def _plot_xx_list(xx_list, rem_coords, ranges, steps, nb_values):
24332436
xx_list = [xx0]
24342437
if len(rem_coords) >= 1:
24352438
xx_list = _plot_xx_list(xx_list, rem_coords, ranges, steps,
2436-
nb_values)
2439+
number_values)
24372440
xmin, xmax = ranges[coord]
24382441
nbp = plot_points[coord]
24392442
dx = (xmax - xmin) / (nbp-1)

src/sage/manifolds/differentiable/tangent_vector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
371371
Tangent vector d/dph at Point p on the 2-dimensional differentiable
372372
manifold S^2
373373
sage: graph_v = v.plot(mapping=F)
374-
sage: graph_S2 = XS.plot(chart=X3, mapping=F, nb_values=9) # long time
374+
sage: graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9) # long time
375375
sage: graph_v + graph_S2 # long time
376376
Graphics3d Object
377377
@@ -388,7 +388,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
388388
p = U.point((pi/4, 7*pi/4), name='p')
389389
v = XS.frame()[1].at(p)
390390
graph_v = v.plot(mapping=F)
391-
graph_S2 = XS.plot(chart=X3, mapping=F, nb_values=9)
391+
graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9)
392392
sphinx_plot(graph_v + graph_S2)
393393
394394
"""

src/sage/manifolds/differentiable/vectorfield.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
652652
Vector field d/dph on the Open subset U of the 2-dimensional
653653
differentiable manifold S^2
654654
sage: graph_v = v.plot(chart=X3, mapping=F, label_axes=False)
655-
sage: graph_S2 = XS.plot(chart=X3, mapping=F, nb_values=9)
655+
sage: graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9)
656656
sage: graph_v + graph_S2
657657
Graphics3d Object
658658
@@ -668,7 +668,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
668668
cos(th)]}, name='F')
669669
v = XS.frame()[1]
670670
graph_v = v.plot(chart=X3, mapping=F, label_axes=False)
671-
graph_S2 = XS.plot(chart=X3, mapping=F, nb_values=9)
671+
graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9)
672672
sphinx_plot(graph_v + graph_S2)
673673
674674
Note that the default values of some arguments of the method ``plot``

src/sage/manifolds/point.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
812812
sage: g = p.plot()
813813
sage: print(g)
814814
Graphics3d Object
815-
sage: gX = X.plot(nb_values=5) # coordinate mesh cube
815+
sage: gX = X.plot(number_values=5) # coordinate mesh cube
816816
sage: g + gX # display of the point atop the coordinate mesh
817817
Graphics3d Object
818818
@@ -836,7 +836,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
836836
F: S^2 --> M
837837
on U: (th, ph) |--> (x, y, z) = (cos(ph)*sin(th), sin(ph)*sin(th), cos(th))
838838
sage: g = p.plot(chart=X, mapping=F)
839-
sage: gS2 = XS.plot(chart=X, mapping=F, nb_values=9)
839+
sage: gS2 = XS.plot(chart=X, mapping=F, number_values=9)
840840
sage: g + gS2
841841
Graphics3d Object
842842
@@ -847,11 +847,11 @@ def plot(self, chart=None, ambient_coords=None, mapping=None,
847847
sage: X.<t,x,y,z> = M.chart()
848848
sage: p = M.point((1,2,3,4), name='p')
849849
sage: g = p.plot(X, ambient_coords=(t,x,y), label_offset=0.4) # the coordinate z is skipped
850-
sage: gX = X.plot(X, ambient_coords=(t,x,y), nb_values=5) # long time
850+
sage: gX = X.plot(X, ambient_coords=(t,x,y), number_values=5) # long time
851851
sage: g + gX # 3D plot # long time
852852
Graphics3d Object
853853
sage: g = p.plot(X, ambient_coords=(t,y,z), label_offset=0.4) # the coordinate x is skipped
854-
sage: gX = X.plot(X, ambient_coords=(t,y,z), nb_values=5) # long time
854+
sage: gX = X.plot(X, ambient_coords=(t,y,z), number_values=5) # long time
855855
sage: g + gX # 3D plot # long time
856856
Graphics3d Object
857857
sage: g = p.plot(X, ambient_coords=(y,z), label_offset=0.4) # the coordinates t and x are skipped

0 commit comments

Comments
 (0)