I read lot of questions about this issue, mainly: the stack code
So,I tried create a list plot with bar legend , using the following code:
ListPlot[List /@ rad[[All, 1 ;; 2]], AxesOrigin -> {0, -90},
DataRange -> {{0, 360}, {-90, 90}}, Frame -> True,
BaseStyle -> {FontFamily -> "Kartika", 12},
FrameLabel -> {"RA (\[Degree])", "DEC (\[Degree])"},
PlotStyle -> ({PointSize[0.002], ColorData["Rainbow"][#/85]} & /@
rad[[All, 3]]), AspectRatio -> 1,
PlotLegends ->
Placed[BarLegend[{"Rainbow"}, LegendMargins -> {{0, 0}, {10, 5}},
LegendLabel -> "Geocentric Velocity [km/seg]",
LegendFunction -> "Panel",
LabelStyle -> {Italic, FontFamily -> "Helvetica"}], Above]]
using the data:
a = RandomReal[360, {1000}];
b = RandomReal[90, {1000}];
c = RandomReal[90, {1000}];
rad = Transpose[{a, b, c}];
It worked fine, but the legendbar did not , it just does not appear, only the plotting.
What did I do wrong?
EDIT 1:
The new code with some suggested modifications:
ListPlot[List /@ rad[[All, 1 ;; 2]], AxesOrigin -> {0, -90},
DataRange -> {{0, 360}, {-90, 90}}, Frame -> True,
FrameLabel -> {"RA (\[Degree])", "DEC (\[Degree])"},
PlotStyle -> ({PointSize[0.002], ColorData["Rainbow"][#/85]} & /@
rad[[All, 3]]), AspectRatio -> 1,
PlotLegends ->
Placed[BarLegend["Rainbow", LegendMargins -> {{0, 0}, {10, 5}},
LegendLabel -> "Geocentric Velocity [km/seg]",
LegendFunction -> "Panel"] Above]]
The resulting plot:
I used the actually data, more than 3.500 points with also negative declinations points (I preferred not using them in this question, as the final LegendBar would be the same using the sample of random data).
And a complement question:
why is the range in bar not 0 -> 90.0?
{0,90}
now. I made the edit when I saw your earlier Comment, which now appears to be gone. $\endgroup$