Changeset 7799:8971fdeaf8a4


Ignore:
Timestamp:
12/08/07 19:02:37 (6 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Message:

trac #1432 -- some plotting examples inspired by the pyx gallery.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/plot/plot.py

    r7676 r7799  
    127127    ... 
    128128    sage: P.show(ymin=-pi,ymax=pi) 
     129 
     130PYX EXAMPLES: 
     131These are some examples of plots similar to some of the plots in the 
     132PyX (http://pyx.sourceforge.net) documentation: 
     133 
     134Symbolline: 
     135    sage: y(x) = x*sin(x**2) 
     136    sage: v = [(x, y(x)) for x in [-3,-2.95,..,3]] 
     137    sage: show(points(v, rgbcolor=(0.2,0.6, 0.1), pointsize=30) + plot(spline(v), -3.1, 3)) 
     138 
     139Cycliclink: 
     140    sage: x = var('x') 
     141    sage: g1 = plot(cos(20*x)*exp(-2*x), 0, 1) 
     142    sage: g2 = plot(2*exp(-30*x) - exp(-3*x), 0, 1) 
     143    sage: show(graphics_array([g1, g2], 2, 1), xmin=0) 
     144 
     145Pi Axis: 
     146In the PyX manual, the point of this example is to show labeling the 
     147X-axis using rational multiples of Pi.  Sage currently has no support 
     148for controlling how the ticks on the x and y axes are labeled, so 
     149this is really a bad example: 
     150 
     151    sage: g1 = plot(sin(x), 0, 2*pi) 
     152    sage: g2 = plot(cos(x), 0, 2*pi, linestyle = "--") 
     153    sage: show(g1 + g2) 
     154 
     155An illustration of integration: 
     156    sage: def f(x): return (x-3)*(x-5)*(x-7)+40 
     157    sage: P = line([(2,0),(2,f(2))], rgbcolor=(0,0,0)) 
     158    sage: P += line([(8,0),(8,f(8))], rgbcolor=(0,0,0)) 
     159    sage: P += polygon([(2,0),(2,f(2))] + [(x, f(x)) for x in [2,2.1,..,8]] + [(8,0),(2,0)],  rgbcolor=(0.8,0.8,0.8)) 
     160    sage: P += text("$\\int_{a}^b f(x) dx$", (5, 20), fontsize=16, rgbcolor=(0,0,0)) 
     161    sage: P += plot(f, 1, 8.5, thickness=3) 
     162    sage: show(P)  
    129163     
    130164AUTHORS: 
Note: See TracChangeset for help on using the changeset viewer.