1
$\begingroup$

Hi I have following code, unfortunately it does not lead to the result of the label G1 shown in black and the label G3 shown in red with fontsize 22.

Data1 = {{1, 3}, {3, 2}, {1, 2}};
Data2 = {{4, 7}, {6, 10}, {5, 8}};
ListPlot[{Data1, Data2},
PlotStyle -> {Black, Red},
PlotRange -> All, 
Frame -> {{True, True}, {True, True}}, 
FrameStyle -> Directive[Black],
ImageSize -> Medium,
FrameLabel -> {Style[{{"G1", Black, 22}, {"G3", Red, 22}}],
Style["G2" , 22]}]

What can be done to lead to following as label for the x-axis?

enter image description here

enter image description here

$\endgroup$
2
$\begingroup$

Change x FrameLabel to Style["G1", Black, 22] Style["G3", Red, 22]

ListPlot[{Data1, Data2}, PlotStyle -> {Black, Red}, PlotRange -> All, 
 Frame -> {{True, True}, {True, True}}, 
 FrameStyle -> Directive[Black], ImageSize -> Medium, 
 FrameLabel -> {Style["G1", Black, 22] Style["G3", Red, 22], 
   Style["G2", 22]}]

enter image description here

Update

As noted by CarlWoll (in the comments), a more robust solution would be to use Row: Row[{Style["G1", Black, 22], Style["G3", Red, 22]}]

$\endgroup$
  • 2
    $\begingroup$ Relying on the Orderless property of Times to get G1 to appear before G3 is not robust. You should use Row instead. $\endgroup$ – Carl Woll Feb 7 '18 at 15:44
  • $\begingroup$ Thanks for the suggestion. $\endgroup$ – Anjan Kumar Feb 7 '18 at 16:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.