Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 45-Degree Line with Marginsplot

    Dear all, I am trying to add a diagonal/45-degree line to my marginsplot, but (function y=x, ...) does not work. Could anyone tell me whether it's possible, and if so how to add a diagonal line to a marginsplot? Thanks a lot in advance.

  • #2
    you don't show us your actual code (please read the FAQ and follow its advice), but the "addplot())" can certainly be used and should do what you want; see
    Code:
    help marginsplot
    and look at the addplot() option

    Comment


    • #3
      Thank you for your quick response, and apologies for not entering the code before. I have plotted some two-way graphs with a diagonal line where it worked perfectly well, but adding
      Code:
      (function y=x, range(L1cons_pc_d_ppp))
      to my marginsplot like this:

      Code:
      marginsplot, xlabel(0(5)30) recast(line) recastci(rarea) ciopt(color(%20)) plotregion(style(none)) graphregion(color(white)) xtitle("Lagged Consumption (per capity/day), USD") ylabel(-3(1)2)  yscale(titlegap(2)) xscale(titlegap(2)) 
       (function y=x, range(L1cons_pc_d_ppp))
      (or before the comma) returned an error. Thank you for your advice regarding addplot(). I just added
      Code:
      addplot(function y=x, range(0 30))
      instead which works well. Thanks a lot!

      Comment


      • #4
        It's a matter of aesthetics, I suppose, but I prefer that so-called 45-degree lines actually be drawn at 45 degrees so would add aspect(1) to the addplot options.

        Comment


        • #5
          Thank you very much for the tip, I will do that!

          Comment

          Working...
          X