I want to put a custom bar legend beside the plots.
barleg= BarLegend[{Blend[{{0, Hue[0., 0.1, 1]}, {1, Hue[0., 0.8, 1]}, {1.01,
Hue[0.3, 0.1, 1]}, {2, Hue[0.3, 0.8, 1]}, {2.01,
Hue[0.7, 0.1, 1]}, {3, Hue[0.7, 0.8, 1]}}, #] &, {0, 3}},
"Ticks" -> {0, 1, 2, 3}, "TickLabels" -> {"0.1", "1", "10", "100"},
LegendLabel ->
Style[HoldForm["\[Epsilon]"], 20, Black, FontFamily -> "Times"],
LabelStyle -> { FontFamily -> "Times", FontSize -> 20},
LegendLayout -> "Row"]
gives what I want to attach:
But when I put this same command in Plot function, it changes simply to red
Plot[{}, {x, 0, 1},
PlotLegends ->
Placed[BarLegend[{Blend[{{0, Hue[0., 0.1, 1]}, {1,
Hue[0., 0.8, 1]}, {1.01, Hue[0.3, 0.1, 1]}, {2,
Hue[0.3, 0.8, 1]}, {2.01, Hue[0.7, 0.1, 1]}, {3,
Hue[0.7, 0.8, 1]}}, #] &, {0, 3}}, "Ticks" -> {0, 1, 2, 3},
"TickLabels" -> {"0.1", "1", "10", "100"},
LegendLabel ->
Style[HoldForm["\[Epsilon]"], 20, Black, FontFamily -> "Times"],
LabelStyle -> { FontFamily -> "Times", FontSize -> 20}], Right]
]
gives
How do I get the exact bar legend with the plot?