This command will produce a chart with two lines on it.

DateListPlot[{CapReg, Equity},  Joined -> True ]

What I would like to do is add a label above the chart "CapReg" in red, and a label below the chart "Equity" in blue. Then I would like to have the color of the CapReg line be red, and the line for Equity be blue. Any ideas?

Many thanks in advance.


1 Answer 1


Something like the following?

 data1 = {{{2006, 10, 1}, 10}, {{2006, 10, 15}, 12}, 
          {{2006, 10, 30},15}, {{2006, 11, 20}, 20}};
 data2 = {{{2006, 10, 5}, 15}, {{2006, 10, 20}, 8}, 
          {{2006, 11, 10},  5}, {{2006, 11, 15}, 1}};
 DateListPlot[{data1, data2}, PlotStyle -> {Red, Blue}, Joined -> True,
 PlotLabel ->  Row[{Style["CapReg", Red, "Section"],Spacer[15],
                    Style["Equity", Blue, "Section"]}]]

enter image description here

EDIT: For placing parts of plot label in various places, you can use option FrameLabel or the built-in function Labeled as follows:

DateListPlot[{data1, data2}, PlotStyle -> {Red, Blue}, Joined -> True,
FrameLabel -> {{"values", None}, {Column[{"dates", Style["Equity", Blue, "Section"]}, 
 Alignment -> Center], Style["CapReg", Red, Bold, "Section"]}}]

enter image description here

 DateListPlot[{data1, data2}, PlotStyle -> {Red, Blue}, Joined -> True, 
 FrameLabel -> {{"values", None}, {"dates", None}}], 
  {Style["CapReg", Red, Bold, "Section"], Style["Equity", Blue, Bold, "Section"]},
  {Top, Bottom}]

enter image description here

  • $\begingroup$ @MikeHoneychurch, thank you for the edit:) I was puzzled for a second itlooked as if Ctrl-C was enough to cut and paste into the right place in SE :) $\endgroup$
    – kglr
    Jun 23, 2012 at 1:32
  • $\begingroup$ No worries. Also minor change in using Spacer rather than a string space. I prefer Spacer since it allows more flexibility. $\endgroup$ Jun 23, 2012 at 1:40
  • $\begingroup$ Thank you, it works good. Is there any way the "Equity" la bel could be placed under the Chart? $\endgroup$
    – John
    Jun 23, 2012 at 2:39
  • $\begingroup$ @John, you can use FrameLabel or Labeled to place the labels in various places. I will edit the post with examples in a moment. $\endgroup$
    – kglr
    Jun 23, 2012 at 3:36
  • $\begingroup$ kguler, thank you for your help. Hope you have a good weekend. $\endgroup$
    – John
    Jun 23, 2012 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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