Coloring surfaces in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter Peaks Freak
  • Start date Start date
  • Tags Tags
    Mathematica Surfaces
Click For Summary
SUMMARY

This discussion focuses on coloring a 3D parametric surface in Mathematica using the ParametricPlot3D function. The user seeks to differentiate points based on the value of a function f defined on the surface M, specifically coloring points white for f(p) >= 0 and gray for f(p) < 0. The solution provided utilizes the ColorFunction option in ParametricPlot3D, demonstrating how to implement a conditional color scheme effectively. The example code illustrates the correct syntax for achieving the desired visual representation.

PREREQUISITES
  • Understanding of 3D parametric surfaces in Mathematica
  • Familiarity with the ParametricPlot3D function
  • Knowledge of defining functions in Mathematica
  • Basic grasp of conditional statements in programming
NEXT STEPS
  • Explore advanced features of ParametricPlot3D in Mathematica
  • Learn about custom ColorFunction implementations in Mathematica
  • Investigate the use of other plotting functions like Plot3D for different surface types
  • Study the impact of color gradients on data visualization in Mathematica
USEFUL FOR

Mathematica users, data visualizers, and mathematicians interested in 3D surface plotting and color representation techniques.

Peaks Freak
Messages
6
Reaction score
0
Hi, all,

I have a question about coloring a 3D parametric surface in Mathematica.

Setup:

Take as given a surface M in R^3 and a parameterization of that surface p:[a,b] x [c,d] -> R^3. Let f:M -> R be a function defined on M.

Question:

How can I plot this surface so that points p with f(p) >= 0 are colored white and points p with f(p) < 0 are colored gray?

Notes:

I'm using ParametricPlot3D and trying to work with the ColorFunction -> Function construct, but can't quite get it right.

Thanks in advance!

P
 
Physics news on Phys.org
You can use the ColorFunction option when you are plotting parametric surfaces. For example, you can try something like this:

ParametricPlot3D[p[u,v], {u,a,b}, {v,c,d},
ColorFunction ->
Function[{x,y,z,u,v},
If[f[p[u,v]] >= 0, White, Gray]]]
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K