Prev: full labeling (top bottom left right) of x and y axes
Next: using set_param for newly sized individual parameters in lookup
From: Simon on 3 Aug 2010 11:44 I am currently modelling a sphere in an XYZ domain using polar coordinates of phi (in range 0, pi) and theta (in range 0, 2*pi) and the radius to create the surface of the sphere. I have modified the ranges of phi and theta so I am not creating a surface of the whole sphere, just between a range of longitudes and latitudes so only a small proportion of the surface is being displayed (like a latitude/longitude square on a 2D map of the world, but projected onto the sphere). I am then calculating values (let's call them C) at locations on this sphere created by a meshgrid of phi and theta using transformation of the polar coordinates into cartesians to give me values of X, Y and Z over this section of the sphere. I can then plot a surf command of surf(X, Y, Z, C) to plot the sphere section in three dimensions, with colours on the surface based on the range of values that are calculated for C at the sphere grid points. At each grid point I'm also calculating another measurement, let's call this one D. I wish to plot the values of D on the surface as colour [so surf(X, Y, Z, D) generates this correctly], but I also want to plot the values of C on the same graph, preferably as contours of equal magnitude. contour3 lets me plot contour(X, Y, C) but this does not plot the value at (X, Y, Z). How can I overlay the contour plot for C values on top of the surface that is displaying the D values as colour data?
From: TideMan on 3 Aug 2010 16:26
On Aug 4, 3:44 am, "Simon " <zin...(a)hotmail.com> wrote: > I am currently modelling a sphere in an XYZ domain using polar coordinates of phi (in range 0, pi) and theta (in range 0, 2*pi) and the radius to create the surface of the sphere. > > I have modified the ranges of phi and theta so I am not creating a surface of the whole sphere, just between a range of longitudes and latitudes so only a small proportion of the surface is being displayed (like a latitude/longitude square on a 2D map of the world, but projected onto the sphere). > > I am then calculating values (let's call them C) at locations on this sphere created by a meshgrid of phi and theta using transformation of the polar coordinates into cartesians to give me values of X, Y and Z over this section of the sphere. > > I can then plot a surf command of surf(X, Y, Z, C) to plot the sphere section in three dimensions, with colours on the surface based on the range of values that are calculated for C at the sphere grid points. > > At each grid point I'm also calculating another measurement, let's call this one D. > > I wish to plot the values of D on the surface as colour [so surf(X, Y, Z, D) generates this correctly], but I also want to plot the values of C on the same graph, preferably as contours of equal magnitude. > > contour3 lets me plot contour(X, Y, C) but this does not plot the value at (X, Y, Z). > > How can I overlay the contour plot for C values on top of the surface that is displaying the D values as colour data? Have a look at this (free) mapping package: http://www.eos.ubc.ca/~rich/map.html You'll see that the logo for m_map is almost exactly what you want. And if you click on the image, you'll see that it involves only 7 lines of code. No screwing about transforming from spherical polars to cartesian, the package does it for you. |