Skip to main content
added 382 characters in body
Source Link
sined
  • 585
  • 2
  • 10

I'm making a 3D plot of the function En1 and I'm attributing its color to the sz1 function below, which contains values spanning from -1 to 1.

En1[δ_, g1_, g2_, k_] := 1/2(-I g1 + I g2 -Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + Iδ)] + δ)

vec1[δ_, g1_, g2_,k_] := {{-((I g1 + I g2 + Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + I δ)] - δ)/1), 2 k}}

vec1d[δ_, g1_, g2_,k_] := {{(I g1 + I g2 - Sqrt[-(g1 + g2 - 2 k - I δ) (g1 + g2 + 2 k - I δ)] + δ)/1, 2 k}}

σz = PauliMatrix[3];
σ0 = IdentityMatrix[2];

sz1[δ_, g1_, g2_, k_] := Flatten[vec1d[δ, g1, g2, k]. σz . Transpose[vec1[δ, g1, g2, k]]][[1]]/Flatten[vec1d[δ, g1, g2, k].Transpose[vec1[δ, g1, g2, k]]][[1]]

g1 = 1;  g2 = 1;

Plot3D[
  {Re[En1[δ, g1, g2, k]]}, 
  {δ, -2, 2}, {k, 0, 2},
  ColorFunction -> Function[{δ, k, z}, ColorData["TemperatureMap"][sz1[δ, g1, g2, k]]], 
  ColorFunctionScaling -> False, 
  PlotLegends -> BarLegend[{ColorData["TemperatureMap"], {-1, 1}}], 
  BoxRatios -> {1, 1, 1}
]

3D plot from code above

As we can see, the color is responding to the function sz1. However, there is an issue with my legend since the gradient of color seems not linear. Is there a way to impose the legend color to vary linearly from -1 to 1?

If we plot sz1 we see that it's odd with respect to the $\delta$ for a fixed k, i.e.,

Plot3D[{sz1[δ, g1, g2, k]}, {δ, -2, 2}, {k, 0, 2}, AxesLabel -> {"δ", "k"}]

enter image description here

However, the color of the 3D plot of Re[En1] is not odd with respect to the color. Do you see any reason for this?

I'm making a 3D plot of the function En1 and I'm attributing its color to the sz1 function below, which contains values spanning from -1 to 1.

En1[δ_, g1_, g2_, k_] := 1/2(-I g1 + I g2 -Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + Iδ)] + δ)

vec1[δ_, g1_, g2_,k_] := {{-((I g1 + I g2 + Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + I δ)] - δ)/1), 2 k}}

vec1d[δ_, g1_, g2_,k_] := {{(I g1 + I g2 - Sqrt[-(g1 + g2 - 2 k - I δ) (g1 + g2 + 2 k - I δ)] + δ)/1, 2 k}}

σz = PauliMatrix[3];
σ0 = IdentityMatrix[2];

sz1[δ_, g1_, g2_, k_] := Flatten[vec1d[δ, g1, g2, k]. σz . Transpose[vec1[δ, g1, g2, k]]][[1]]/Flatten[vec1d[δ, g1, g2, k].Transpose[vec1[δ, g1, g2, k]]][[1]]

g1 = 1;  g2 = 1;

Plot3D[
  {Re[En1[δ, g1, g2, k]]}, 
  {δ, -2, 2}, {k, 0, 2},
  ColorFunction -> Function[{δ, k, z}, ColorData["TemperatureMap"][sz1[δ, g1, g2, k]]], 
  ColorFunctionScaling -> False, 
  PlotLegends -> BarLegend[{ColorData["TemperatureMap"], {-1, 1}}], 
  BoxRatios -> {1, 1, 1}
]

3D plot from code above

As we can see, the color is responding to the function sz1. However, there is an issue with my legend since the gradient of color seems not linear. Is there a way to impose the legend color to vary linearly from -1 to 1?

I'm making a 3D plot of the function En1 and I'm attributing its color to the sz1 function below, which contains values spanning from -1 to 1.

En1[δ_, g1_, g2_, k_] := 1/2(-I g1 + I g2 -Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + Iδ)] + δ)

vec1[δ_, g1_, g2_,k_] := {{-((I g1 + I g2 + Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + I δ)] - δ)/1), 2 k}}

vec1d[δ_, g1_, g2_,k_] := {{(I g1 + I g2 - Sqrt[-(g1 + g2 - 2 k - I δ) (g1 + g2 + 2 k - I δ)] + δ)/1, 2 k}}

σz = PauliMatrix[3];
σ0 = IdentityMatrix[2];

sz1[δ_, g1_, g2_, k_] := Flatten[vec1d[δ, g1, g2, k]. σz . Transpose[vec1[δ, g1, g2, k]]][[1]]/Flatten[vec1d[δ, g1, g2, k].Transpose[vec1[δ, g1, g2, k]]][[1]]

g1 = 1;  g2 = 1;

Plot3D[
  {Re[En1[δ, g1, g2, k]]}, 
  {δ, -2, 2}, {k, 0, 2},
  ColorFunction -> Function[{δ, k, z}, ColorData["TemperatureMap"][sz1[δ, g1, g2, k]]], 
  ColorFunctionScaling -> False, 
  PlotLegends -> BarLegend[{ColorData["TemperatureMap"], {-1, 1}}], 
  BoxRatios -> {1, 1, 1}
]

3D plot from code above

As we can see, the color is responding to the function sz1. However, there is an issue with my legend since the gradient of color seems not linear. Is there a way to impose the legend color to vary linearly from -1 to 1?

If we plot sz1 we see that it's odd with respect to the $\delta$ for a fixed k, i.e.,

Plot3D[{sz1[δ, g1, g2, k]}, {δ, -2, 2}, {k, 0, 2}, AxesLabel -> {"δ", "k"}]

enter image description here

However, the color of the 3D plot of Re[En1] is not odd with respect to the color. Do you see any reason for this?

Formatted code, special characters
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

I'm making a 3D plot of the function En1 and I'm attributing its color to the sz1 function below, which contains values spanning from -1 to 1.

En1[\[Delta]_En1[δ_, g1_, g2_, k_] :=1= 1/2(-I g1 + I g2 -Sqrt[-(g1 + g2 - 2 k + I \[Delta]δ) (g1 + g2 + 2 k + I\[Delta])]+\[Delta]] + δ)

vec1[\[Delta]_vec1[δ_, g1_, g2_,k_] := {{-((I g1 + I g2 + Sqrt[-(g1 + g2 - 2 k + I \[Delta]δ) (g1 + g2 + 2 k + I \[Delta]δ)] - \[Delta]δ)/1), 2 k}}

vec1d[\[Delta]_vec1d[δ_, g1_, g2_,k_] := {{(I g1 + I g2 - Sqrt[-(g1 + g2 - 2 k - I \[Delta]δ) (g1 + g2 + 2 k - I \[Delta]δ)] + \[Delta]δ)/1, 2 k}}

\[Sigma]zσz = PauliMatrix[3];
\[Sigma]0σ0 = IdentityMatrix[2];
 

sz1[\[Delta]_sz1[δ_, g1_, g2_, k_] := Flatten[vec1d[\[Delta]Flatten[vec1d[δ, g1, g2, k].\Sigma]z σz .Transpose[vec1[\[Delta] Transpose[vec1[δ, g1, g2, k]]][[1]]/Flatten[vec1d[\[Delta]Flatten[vec1d[δ, g1, g2, k].Transpose[vec1[\[Delta]Transpose[vec1[δ, g1, g2, k]]][[1]]
 

g1 g1=1;
= g2=1;1;  g2 = 1;

Plot3D[
  {Re[En1[\[Delta]Re[En1[δ, g1, g2, k]]}, 
  {\[Delta]δ, -2, 2}, {k, 0, 2},
  ColorFunction -> Function[{\[Delta]δ, k, z}, ColorData["TemperatureMap"][sz1[\[Delta]ColorData["TemperatureMap"][sz1[δ, g1, g2, k]]], 
  ColorFunctionScaling -> False, 
  PlotLegends -> BarLegend[{ColorData["TemperatureMap"], {-1, 1}}], 
  BoxRatios -> {1, 1, 1} 
]

enter image description here3D plot from code above

As we can see, the color is responding to the function sz1, howeversz1. However, there is an issue with my legend since the gradient of color seems not linear. Is there a way to impose the legend color to vary linearly from -1 to 1?

I'm making a 3D plot of the function En1 and I'm attributing its color to the sz1 function below, which contains values spanning from -1 to 1.

En1[\[Delta]_, g1_, g2_, k_]:=1/2(-I g1 + I g2 -Sqrt[-(g1 + g2 - 2 k + I \[Delta]) (g1 + g2 + 2 k + I\[Delta])]+\[Delta])

vec1[\[Delta]_, g1_, g2_,k_] := {{-((I g1 + I g2 + Sqrt[-(g1 + g2 - 2 k + I \[Delta]) (g1 + g2 + 2 k + I \[Delta])] - \[Delta])/1), 2 k}}

vec1d[\[Delta]_, g1_, g2_,k_] := {{(I g1 + I g2 - Sqrt[-(g1 + g2 - 2 k - I \[Delta]) (g1 + g2 + 2 k - I \[Delta])] + \[Delta])/1, 2 k}}

\[Sigma]z = PauliMatrix[3];
\[Sigma]0 = IdentityMatrix[2];
 

sz1[\[Delta]_, g1_, g2_, k_] := Flatten[vec1d[\[Delta], g1, g2, k].\Sigma]z.Transpose[vec1[\[Delta], g1, g2, k]]][[1]]/Flatten[vec1d[\[Delta], g1, g2, k].Transpose[vec1[\[Delta], g1, g2, k]]][[1]]
 

 g1=1;
 g2=1;

Plot3D[{Re[En1[\[Delta], g1, g2, k]]}, {\[Delta], -2, 2}, {k, 0, 2},ColorFunction -> Function[{\[Delta], k, z}, ColorData["TemperatureMap"][sz1[\[Delta], g1, g2, k]]], ColorFunctionScaling -> False, PlotLegends -> BarLegend[{ColorData["TemperatureMap"], {-1, 1}}], BoxRatios -> {1, 1, 1}]

enter image description here

As we can see, the color is responding to the function sz1, however, there is an issue with my legend since the gradient of color seems not linear. Is there a way to impose the legend color to vary linearly from -1 to 1?

I'm making a 3D plot of the function En1 and I'm attributing its color to the sz1 function below, which contains values spanning from -1 to 1.

En1[δ_, g1_, g2_, k_] := 1/2(-I g1 + I g2 -Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + )] + δ)

vec1[δ_, g1_, g2_,k_] := {{-((I g1 + I g2 + Sqrt[-(g1 + g2 - 2 k + I δ) (g1 + g2 + 2 k + I δ)] - δ)/1), 2 k}}

vec1d[δ_, g1_, g2_,k_] := {{(I g1 + I g2 - Sqrt[-(g1 + g2 - 2 k - I δ) (g1 + g2 + 2 k - I δ)] + δ)/1, 2 k}}

σz = PauliMatrix[3];
σ0 = IdentityMatrix[2];

sz1[δ_, g1_, g2_, k_] := Flatten[vec1d[δ, g1, g2, k]. σz . Transpose[vec1[δ, g1, g2, k]]][[1]]/Flatten[vec1d[δ, g1, g2, k].Transpose[vec1[δ, g1, g2, k]]][[1]]

g1 = 1;  g2 = 1;

Plot3D[
  {Re[En1[δ, g1, g2, k]]}, 
  {δ, -2, 2}, {k, 0, 2},
  ColorFunction -> Function[{δ, k, z}, ColorData["TemperatureMap"][sz1[δ, g1, g2, k]]], 
  ColorFunctionScaling -> False, 
  PlotLegends -> BarLegend[{ColorData["TemperatureMap"], {-1, 1}}], 
  BoxRatios -> {1, 1, 1} 
]

3D plot from code above

As we can see, the color is responding to the function sz1. However, there is an issue with my legend since the gradient of color seems not linear. Is there a way to impose the legend color to vary linearly from -1 to 1?

Source Link
sined
  • 585
  • 2
  • 10

Issues with Plotlegend

I'm making a 3D plot of the function En1 and I'm attributing its color to the sz1 function below, which contains values spanning from -1 to 1.

En1[\[Delta]_, g1_, g2_, k_]:=1/2(-I g1 + I g2 -Sqrt[-(g1 + g2 - 2 k + I \[Delta]) (g1 + g2 + 2 k + I\[Delta])]+\[Delta])

vec1[\[Delta]_, g1_, g2_,k_] := {{-((I g1 + I g2 + Sqrt[-(g1 + g2 - 2 k + I \[Delta]) (g1 + g2 + 2 k + I \[Delta])] - \[Delta])/1), 2 k}}

vec1d[\[Delta]_, g1_, g2_,k_] := {{(I g1 + I g2 - Sqrt[-(g1 + g2 - 2 k - I \[Delta]) (g1 + g2 + 2 k - I \[Delta])] + \[Delta])/1, 2 k}}

\[Sigma]z = PauliMatrix[3];
\[Sigma]0 = IdentityMatrix[2];


sz1[\[Delta]_, g1_, g2_, k_] := Flatten[vec1d[\[Delta], g1, g2, k].\Sigma]z.Transpose[vec1[\[Delta], g1, g2, k]]][[1]]/Flatten[vec1d[\[Delta], g1, g2, k].Transpose[vec1[\[Delta], g1, g2, k]]][[1]]


 g1=1;
 g2=1;

Plot3D[{Re[En1[\[Delta], g1, g2, k]]}, {\[Delta], -2, 2}, {k, 0, 2},ColorFunction -> Function[{\[Delta], k, z}, ColorData["TemperatureMap"][sz1[\[Delta], g1, g2, k]]], ColorFunctionScaling -> False, PlotLegends -> BarLegend[{ColorData["TemperatureMap"], {-1, 1}}], BoxRatios -> {1, 1, 1}]

enter image description here

As we can see, the color is responding to the function sz1, however, there is an issue with my legend since the gradient of color seems not linear. Is there a way to impose the legend color to vary linearly from -1 to 1?