Color Contour Plots for Varying Gamma Values in a Simple Equation

  • Mathematica
  • Thread starter member 428835
  • Start date
  • Tags
    Color Plots
In summary, the conversation is about how to make each plot for ##\gamma## a different color. The suggested solution involves using the ColorFunction option in ContourPlot, and a manual method for creating plots with different colors for different values of ##\gamma##.
  • #1
member 428835
Hi PF!

I'm wondering if anyone knows how to make each plot for ##\gamma## a different color. What I have so far is
Code:
\[Gamma] = {0.01, 0.05, 0.1, 0.5, 1, 2};
ContourPlot[(1 + 2 \[Gamma]) \[Sigma]^2 +
   4 \[Gamma] Cos[k\[CapitalDelta]x] \[Sigma] - (1 - 2 \[Gamma]) ==
  0, {k\[CapitalDelta]x, 0, \[Pi]}, {\[Sigma], -1, 1},
 FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"}]
 
Physics news on Phys.org
  • #3
I don't know a neat way to condense it, but you can do it "by hand" using
Code:
f[\[Gamma]_,
  k\[CapitalDelta]x_, \[Sigma]_] := (1 + 2 \[Gamma]) \[Sigma]^2 +
  4 \[Gamma] Cos[k\[CapitalDelta]x] \[Sigma] - (1 - 2 \[Gamma])

Show[ContourPlot[
  f[0.01, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Black],
ContourPlot[
  f[0.05, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Orange],
ContourPlot[
  f[0.1, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Green],
ContourPlot[
  f[0.5, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Yellow],
ContourPlot[
  f[1, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Red],
ContourPlot[
  f[2, k\[CapitalDelta]x, \[Sigma]] == 0, {k\[CapitalDelta]x,
   0, \[Pi]}, {\[Sigma], -1, 1},
  FrameLabel -> {"k\[CapitalDelta]x", "\[Sigma]"},
  ContourStyle -> Blue]]
 
  • #4
Thank you both; I'll post if I find a quicker way.
 

Related to Color Contour Plots for Varying Gamma Values in a Simple Equation

1. What is a color contour plot?

A color contour plot is a type of graph used to visualize data that varies continuously over two dimensions. It uses color to represent the magnitude of the data at different points on the plot.

2. What is the purpose of using varying gamma values in a simple equation on a color contour plot?

The purpose of varying gamma values in a simple equation on a color contour plot is to explore the effects of different gamma values on the resulting plot. This can help to understand how changing the gamma value affects the data and can reveal patterns or relationships that may not be visible with a single gamma value.

3. How are gamma values chosen for a color contour plot?

Gamma values for a color contour plot are typically chosen based on the range of values in the data set. A larger gamma value will result in a more contrasted plot, while a smaller gamma value will result in a smoother plot.

4. What types of data are best suited for a color contour plot?

Color contour plots are best suited for continuous data that varies over two dimensions. This can include data from scientific experiments, mathematical functions, and geographical data such as elevation or temperature.

5. What are the benefits of using color contour plots in scientific research?

Color contour plots are beneficial in scientific research as they provide a visual representation of data that can reveal patterns and relationships that may not be obvious in a table or traditional graph. They also allow for the exploration of different gamma values, providing a more comprehensive understanding of the data.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
919
  • Classical Physics
Replies
0
Views
251
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
Back
Top