# HG changeset patch
# User Karl-Dieter Crisman <kcrisman@gmail.com>
# Date 1295469493 18000
# Node ID a90f5acfc025b55693ec68be37b4d3a4870e8382
# Parent 915d4c9531ae57275a2fbad18fec6e708f13fd31
Trac # 2100 - make sure new default aspect ratio doesn't confuse plot_vector_field3d and vector plotting
diff -r 915d4c9531ae -r a90f5acfc025 sage/plot/plot3d/base.pyx
a
|
b
|
|
943 | 943 | opts['aspect_ratio'] = (1, 1, 1) |
944 | 944 | if not isinstance(opts['aspect_ratio'], (str, list, tuple)): |
945 | 945 | raise TypeError, 'aspect ratio must be a string, list, tuple, or 1' |
| 946 | # deal with any aspect_ratio instances passed from the default options to plot |
| 947 | if opts['aspect_ratio'] == 'auto': |
| 948 | opts['aspect_ratio'] = 'automatic' |
946 | 949 | |
947 | 950 | if opts['frame_aspect_ratio'] == 'automatic': |
948 | 951 | if opts['aspect_ratio'] != 'automatic': |
… |
… |
|
1025 | 1028 | |
1026 | 1029 | sage: sphere((0,0,0)) |
1027 | 1030 | |
1028 | | EXAMPLES: We illustrate use of the aspect_ratio option:: |
| 1031 | EXAMPLES: We illustrate use of the ``aspect_ratio`` option:: |
1029 | 1032 | |
1030 | 1033 | sage: x, y = var('x,y') |
1031 | 1034 | sage: p = plot3d(2*sin(x*y), (x, -pi, pi), (y, -pi, pi)) |
… |
… |
|
1039 | 1042 | |
1040 | 1043 | sage: p.show(aspect_ratio=[1,1,1], frame_aspect_ratio=[1,1,1/8]) |
1041 | 1044 | |
| 1045 | This example shows indirectly that we can accept the default |
| 1046 | from :func:`~sage.plot.plot.plot` of ``aspect_ratio='auto'``, if desired:: |
| 1047 | |
| 1048 | sage: plot(vector([1,2,3])) |
| 1049 | |
1042 | 1050 | We use the 'canvas3d' backend from inside the notebook to get a view of |
1043 | 1051 | the plot rendered inline using HTML canvas:: |
1044 | 1052 | |
diff -r 915d4c9531ae -r a90f5acfc025 sage/plot/plot3d/plot_field3d.py
a
|
b
|
|
57 | 57 | sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),plot_points=4) |
58 | 58 | sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),plot_points=[3,5,7]) |
59 | 59 | sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),center_arrows=True) |
| 60 | |
| 61 | TESTS: |
| 62 | |
| 63 | This tests that Trac # 2100 is fixed in a way compatible with this command:: |
| 64 | |
| 65 | sage: plot_vector_field3d((x*cos(z),-y*cos(z),sin(z)), (x,0,pi), (y,0,pi), (z,0,pi),center_arrows=True,aspect_ratio=(1,2,1)) |
60 | 66 | """ |
61 | 67 | (ff,gg,hh), ranges = setup_for_eval_on_grid(functions, [xrange, yrange, zrange], plot_points) |
62 | 68 | xpoints, ypoints, zpoints = [srange(*r, include_endpoint=True) for r in ranges] |