I have a dataset like as follows:
data =
{{{409,63},{420,65},{440,70},{460,73},{480,71},{510,70}},{{409,63},{420,66},{440,76},{460,81},{480,74},{510,79}},{{409,67},{420,62},{440,72},{460,75},{480,82},{510,71}},{{409,66},{420,64},{440,74},{460,75},{480,74},{510,77}},{{409,83},{420,75},{440,72},{460,74},{480,74},{510,77}},{{409,83},{420,75},{440,74},{460,75},{480,71},{510,77}},{{409,73},{420,60},{440,70},{460,73},{480,72},{510,78}},{{409,73},{420,62},{440,78},{460,73},{480,73},{510,60}},{{409,80},{420,69},{440,72},{460,74},{480,77},{510,75}}};
I have plotted it with the following code. It’s working, but I have the problem that I can not control the legends. I want to change the interval between two legends and break the legends into two columns for clear visualization. Can anyone please help me?
ticks(minimum_, maximum_, interval_, length_, label_, digits_, decimaldigs_) :=
Module({maxCount, Ticks},
maxCount = Floor(((maximum - minimum)/interval));
If(label == 1,
Ticks =
Table(
{minimum + (interval*j),
If(IntegerQ(#),
#,
NumberForm(#, {digits, decimaldigs}))& @ (minimum + (interval*j)),
{length, 0}},
{j, 0, maxCount}),
Ticks =
Table({minimum + (interval*j), "", {length, 0}}, {j, 0, maxCount}));
Join(Ticks));
ticklength = .0120;
ticksleft = ticks(40, 90, 10, ticklength, 1, 6, 0);
ticksdown = ticks(400, 550, 50, ticklength, 1, 3, 0);
legend =
{lex, Q - 0.05, , Q - 0.1, , Q - 0.15, , Q - 0.25, , Q - 0.3, , Q - 0.4, ,
Q - 0.6, , Q - 0.8, , Q - 1.0};
plotmarker = {●, ▼, ▲, ■, ◆, ✶, ★, ♫, ♪};
color =
{Hue(0, 1, 0), Hue(0.7, 1, 1), Hue(0.5, 1, 1), Hue(0.4, 0.2, 1),
Hue(0.35, 0.6, 1), Hue(0.15, 1, 1), Hue(0.9, 0.2, 1), Hue(0.1, 1, 1),
Hue(0.0, 0.6, 1), Hue(0, 1, 1)};
legendmarker =
{Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("●", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("▼", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("▲", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("■", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("◆", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("✶", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("★", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("♫", {0, 0})}),
Graphics({Line({{-0.077, 0}, {0.07, 0}}), Text("♪", {0, 0})})};
plot =
Show(
Table(
ListLinePlot(
Transpose(
{Select(
Drop(PadRight(datafile, {Automatic, Automatic}, "NA"), 1)((All, 2*i - 1)),
NumberQ),
Select(
Drop(PadRight(datafile, {Automatic, Automatic}, "NA"), 1)((All, 2*i)),
NumberQ)}),
PlotLegends ->
Placed(SwatchLegend({legend((2*i))},
LegendMarkers -> legendmarker((i)), LegendMarkerSize -> 5,
LegendLayout -> {"Column", 2}), {0.9, 0.4}),
PlotStyle -> {Dashing({.0071, 0.015}), color((i))},
PlotMarkers -> {plotmarker((i)), 15} , Frame -> True,
FrameStyle -> Directive(Black, Thickness(0.004)),
FrameLabel ->
{Style(
"!(*SubscriptBox((λ), (ex))) (nm)", Black,
FontFamily -> "Times New Roman", FontSize -> 16),
Style(
"!(*SubscriptBox((A), (2)))", Black,
FontFamily -> "Times", FontSize -> 16)},
PlotRange -> {{400, 550}, {45, 90}},
FrameTicks -> {{ticksleft, None}, {ticksdown, None}},
ImageSize -> 500,
BaseStyle -> {FontFamily -> "Times", FontSize -> 10}), {i, 1,
Length(data)}))