#13087: allow calling contour_plot with matrices
---------------------------+------------------------------------------------
Reporter: kcrisman | Owner: jason, was
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.1
Component: graphics | Keywords:
Work issues: | Report Upstream: N/A
Reviewers: | Authors:
Merged in: | Dependencies:
Stopgaps: |
---------------------------+------------------------------------------------
See [https://groups.google.com/forum/?fromgroups#!topic/sage-
support/rAsoRoKCmzw this sage-support thread].
{{{
>Use the matplotlib contour functions directly, which do take matrices.
>
>Define a function which returns the matrix value, given an x and y
>
>Use interpolation to make the last point a little smarter.
>
>Here's an example where I use scipy to interpolate values:
>
V = matrix([
[0.020, 0.020, 0.016, 0.014, 0.011, 0.011],
[0.021, 0.018, 0.016, 0.013, 0.010, 0.011],
[0.017, 0.015, 0.015, 0.012, 0.010, 0.011],
[0.013, 0.013, 0.011, 0.009, 0.007, 0.009],
[0.011, 0.010, 0.009, 0.007, 0.005, 0.007],
[0.010, 0.009, 0.009, 0.007, 0.005, 0.007]
])
from scipy.interpolate import interp2d
g=interp2d(range(V.nrows()), range(V.ncols()), V.numpy())
def f(x,y):
return g(x,y)[0]
contour_plot(f,(0,V.nrows()), (0,V.ncols()),plot_points=100,
colorbar=True)
>
>See http://aleph.sagemath.org/?q=99e63821-cafa-423f-ae8e-d94174a62a87
}}}
Or, we could even call the contour plot in matplotlib directly, according
to Jason.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13087>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.