Ticket #2236: plot_fix_endpoints.patch
| File plot_fix_endpoints.patch, 1.4 kB (added by jason, 9 months ago) |
|---|
-
a/sage/plot/plot.py
old new 3321 3321 We can change the line style to one of '--' (dashed), '-.' (dash dot), 3322 3322 '-' (solid), 'steps', ':' (dotted): 3323 3323 sage: plot(sin(x), 0, 10, linestyle='-.') 3324 3325 TESTS: 3326 We do not randomize the endpoints: 3327 sage: p = plot(x, (x,-1,1)) 3328 sage: p[0].xdata[0] == -1 3329 True 3330 sage: p[0].xdata[-1] == 1 3331 True 3332 3324 3333 """ 3325 3334 def _reset(self): 3326 3335 o = self.options … … 3402 3411 exceptions = 0; msg='' 3403 3412 for i in range(plot_points): 3404 3413 xi = xmin + i*delta 3405 if i < plot_points: 3414 # Slightly randomize points except for the first and last 3415 if i > 0 and i < plot_points-1: 3406 3416 xi += delta*random.random() 3407 3417 if xi > xmax: 3408 3418 xi = xmax 3409 el se:3419 elif i == plot_points-1: 3410 3420 xi = xmax # guarantee that we get the last point. 3411 3421 3412 3422 try: