@@ -63,10 +63,10 @@ def setup_for_eval_on_grid(funcs,
6363
6464 EXAMPLES::
6565
66- sage: x,y,z= var('x,y,z')
67- sage: f(x,y)= x+y-z
68- sage: g(x,y)= x+y
69- sage: h(y)= -y
66+ sage: x,y,z = var('x,y,z')
67+ sage: f(x,y) = x+y-z
68+ sage: g(x,y) = x+y
69+ sage: h(y) = -y
7070 sage: sage.plot.misc.setup_for_eval_on_grid(f, [(0, 2),(1,3),(-4,1)], plot_points=5)
7171 (<sage...>, [(0.0, 2.0, 0.5), (1.0, 3.0, 0.5), (-4.0, 1.0, 1.25)])
7272 sage: sage.plot.misc.setup_for_eval_on_grid([g,h], [(0, 2),(-1,1)], plot_points=5)
@@ -149,20 +149,21 @@ def setup_for_eval_on_grid(funcs,
149149 # pad the variables if we don't have enough
150150 nargs = len (ranges )
151151 if len (vars ) < nargs :
152- vars += ('_' ,)* (nargs - len (vars ))
152+ vars += ('_' ,) * (nargs - len (vars ))
153153
154154 ranges = [[float (z ) for z in r ] for r in ranges ]
155155
156156 if plot_points is None :
157157 plot_points = 2
158158
159159 if not isinstance (plot_points , (list , tuple )):
160- plot_points = [plot_points ]* len (ranges )
160+ plot_points = [plot_points ] * len (ranges )
161161 elif len (plot_points ) != nargs :
162162 raise ValueError ("plot_points must be either an integer or a list of integers, one for each range" )
163163
164164 plot_points = [int (p ) if p >= 2 else 2 for p in plot_points ]
165- range_steps = [abs (range [1 ] - range [0 ])/ (p - 1 ) for range , p in zip (ranges , plot_points )]
165+ range_steps = [abs (range [1 ] - range [0 ]) / (p - 1 )
166+ for range , p in zip (ranges , plot_points )]
166167 if min (range_steps ) == float (0 ):
167168 raise ValueError ("plot start point and end point must be different" )
168169
@@ -206,11 +207,12 @@ def try_make_fast(f):
206207
207208 # Handle vectors, lists, tuples, etc.
208209 if isinstance (funcs , Iterable ):
209- funcs = tuple ( try_make_fast (f ) for f in funcs )
210+ funcs = tuple (try_make_fast (f ) for f in funcs )
210211 else :
211212 funcs = try_make_fast (funcs )
212213
213- #TODO: raise an error if there is a function/method in funcs that takes more values than we have ranges
214+ # TODO: raise an error if there is a function/method in funcs that
215+ # takes more values than we have ranges
214216
215217 if return_vars :
216218 return (funcs ,
@@ -242,10 +244,10 @@ def unify_arguments(funcs):
242244
243245 EXAMPLES::
244246
245- sage: x,y,z= var('x,y,z')
246- sage: f(x,y)= x+y-z
247- sage: g(x,y)= x+y
248- sage: h(y)= -y
247+ sage: x,y,z = var('x,y,z')
248+ sage: f(x,y) = x+y-z
249+ sage: g(x,y) = x+y
250+ sage: h(y) = -y
249251 sage: sage.plot.misc.unify_arguments((f,g,h))
250252 ((x, y, z), (z,))
251253 sage: sage.plot.misc.unify_arguments((g,h))
@@ -284,7 +286,9 @@ def _multiple_of_constant(n, pos, const):
284286 r"""
285287 Function for internal use in formatting ticks on axes with
286288 nice-looking multiples of various symbolic constants, such
287- as `\pi` or `e`. Should only be used via keyword argument
289+ as `\pi` or `e`.
290+
291+ This should only be used via keyword argument
288292 `tick_formatter` in :meth:`plot.show`. See documentation
289293 for the matplotlib.ticker module for more details.
290294
@@ -311,11 +315,11 @@ def _multiple_of_constant(n, pos, const):
311315 from sage .misc .latex import latex
312316 from sage .rings .continued_fraction import continued_fraction
313317 from sage .rings .infinity import Infinity
314- cf = continued_fraction (n / const )
318+ cf = continued_fraction (n / const )
315319 k = 1
316320 while cf .quotient (k ) != Infinity and cf .denominator (k ) < 12 :
317321 k += 1
318- return '$%s$' % latex (cf .convergent (k - 1 ) * const )
322+ return '$%s$' % latex (cf .convergent (k - 1 ) * const )
319323
320324
321325def get_matplotlib_linestyle (linestyle , return_type ):
@@ -401,10 +405,14 @@ def get_matplotlib_linestyle(linestyle, return_type):
401405 {'solid', 'dashed', 'dotted', dashdot', 'None'}, respectively {'-',
402406 '--', ':', '-.', ''}
403407 """
404- long_to_short_dict = {'solid' : '-' ,'dashed' : '--' , 'dotted' : ':' ,
405- 'dashdot' :'-.' }
406- short_to_long_dict = {'-' : 'solid' ,'--' : 'dashed' , ':' : 'dotted' ,
407- '-.' :'dashdot' }
408+ long_to_short_dict = {'solid' : '-' ,
409+ 'dashed' : '--' ,
410+ 'dotted' : ':' ,
411+ 'dashdot' : '-.' }
412+ short_to_long_dict = {'-' : 'solid' ,
413+ '--' : 'dashed' ,
414+ ':' : 'dotted' ,
415+ '-.' : 'dashdot' }
408416
409417 # We need this to take care of region plot. Essentially, if None is
410418 # passed, then we just return back the same thing.
@@ -416,16 +424,16 @@ def get_matplotlib_linestyle(linestyle, return_type):
416424 elif linestyle .startswith ("steps" ):
417425 if linestyle .startswith ("steps-mid" ):
418426 return "steps-mid" + get_matplotlib_linestyle (
419- linestyle .strip ("steps-mid" ), "short" )
427+ linestyle .strip ("steps-mid" ), "short" )
420428 elif linestyle .startswith ("steps-post" ):
421429 return "steps-post" + get_matplotlib_linestyle (
422- linestyle .strip ("steps-post" ), "short" )
430+ linestyle .strip ("steps-post" ), "short" )
423431 elif linestyle .startswith ("steps-pre" ):
424432 return "steps-pre" + get_matplotlib_linestyle (
425- linestyle .strip ("steps-pre" ), "short" )
433+ linestyle .strip ("steps-pre" ), "short" )
426434 else :
427435 return "steps" + get_matplotlib_linestyle (
428- linestyle .strip ("steps" ), "short" )
436+ linestyle .strip ("steps" ), "short" )
429437
430438 if return_type == 'short' :
431439 if linestyle in short_to_long_dict .keys ():
0 commit comments