I'm triying to plot the following matrix:
a = Pi/6;
g := 2.4(*eV A*);
kD := 0.026 (*A^-1*);
D0 := -0.592(*eV*);
R := 10(*A*);
L = 3 (*A*);
f1[x_, l_] :=
BesselJ[(l*Pi)/a + 1, x] BesselJ[(l*Pi)/a, x];
l1 = NSolve[f1[x, l] == 0 && 0 <= x < 100 /. l -> 1, x, Reals];
zl1 = Table[{x /. l1[[i]], 0}, {i, 1, Length[l1]}];
zzl1 = Table[x /. l1[[i]], {i, 1, Length[l1]}];
El1[n_, m_] :=
Sqrt[(D0/2)^2 + ((g*zzl1[[n]])/
R)^2 + ((g*Pi*m)/L)^2];
A[n_, m_] :=
Sqrt[4/(a L)]*\[Sqrt]((1 + g^2/(D0/2 +
El1[n, m])^2*(Pi^2 m^2)/L^2)*R^2/
2 (BesselJ[Pi/a, zzl1[[n]]]^2 -
BesselJ[Pi/a + 1,
zzl1[[n]]] BesselJ[Pi/a - 1,
zzl1[[n]]]) + g^2/(D0/2 +
El1[n, m])^2*zzl1[[n]]^2/
2 (BesselJ[Pi/a + 1, zzl1[[n]]]^2 -
BesselJ[Pi/a + 2,
zzl1[[n]]] BesselJ[Pi/a, zzl1[[n]]]));
d[n_, m_] :=
A[1, 1] Conjugate[A[n, m]] Integrate[
z Sin[Pi/L z] Sin[(m Pi)/L z], {z, 0, L}] Integrate[
Sin[Pi/a y] Sin[Pi/a y], {y,
0, a}] ((1 + g^2/((D0/2 +
El1[1, 1]) (D0/2 +
El1[n, m]))*(Pi^2 m*1)/L^2) Integrate[
r BesselJ[Pi/a,
zzl1[[1]]/R r] BesselJ[Pi/a, zzl1[[n]]/R r], {r, 0,
R}] + (g^2 Sqrt[zzl1[[1]] zzl1[[n]]]/
R^2)/((D0/2 + El1[1, 1]) (D0/2 +
El1[n, m]))*
Integrate[
r BesselJ[Pi/a + 1,
zzl1[[1]]/R r] BesselJ[Pi/a + 1,
zzl1[[n]]/R r], {r, 0, R}]);
T = ParallelTable[Abs[d[n, m]]^2/
Abs[d[1, 1]]^2, {n, 1, 10}, {m, 1, 10}];
MatrixPlot[T, PlotLegends -> Automatic, ColorFunctionScaling -> True,
ColorFunction -> "AvocadoColors", Mesh -> All,
MeshStyle -> Directive[Gray, Dashed], ImageSize -> {600, 600},
AspectRatio -> 1, Frame -> True,
FrameStyle -> Directive[Black, Thick, 23]]
Now, I want a color code as:
BarLegend[{"AvocadoColors", {0, 1}}, LegendMarkerSize -> 400,
LegendMargins -> {{0, 0}, {0, 0}}, LegendMarkers -> "Square",
LabelStyle -> {Black, FontFamily -> "Times", FontSize -> 15}]
Do you know how I can get it?
Thanks.
{0, 1}
, consequently, it only uses half of the color gradient's range. With the scaling set toFalse
most of your data is effectively zero. $\endgroup$