Announcement

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

  • graph constant variables

    Hi, for example i have 3 variables with constans and i want to graph a line that follows each constant (like in the image).
    Thank you very much.
    X1 X2 X3
    5 10 15
    5 10 15
    5 10 15
    5 10 15
    Click image for larger version

Name:	x1g.png
Views:	1
Size:	8.4 KB
ID:	1556415

  • #2
    You need a different data layout to do this, as advised in response to your cross-posting at https://www.reddit.com/r/stata/comments/guzbhg/graph_constant_variables/



    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(x1 x2 x3)
    5 10 15
    5 10 15
    5 10 15
    5 10 15
    end
    
    preserve
    gen id = _n
    reshape long x, i(id) j(order)
    twoway connected x order , xla(1 2 3)
    restore
    Please see https://www.statalist.org/forums/help (#12 on presenting data examples and #8 on cross-posting policy)

    Comment


    • #3
      A "constant variable" may be a difficult case indeed.

      Not sure about the use of the graph, but perhaps just an alternative:
      Code:
      graph bar x*
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	82.4 KB
ID:	1556563

      Comment

      Working...
      X