Announcement

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

  • Obtain list of graphs

    Dear All,

    I have a code that builds (and names) several graphs, here is a snapshot of the tabs of the graphs viewer:

    Click image for larger version

Name:	stata_graphs.png
Views:	1
Size:	8.5 KB
ID:	1739280



    I then export all of them to PDF, and to obtain a list I am using -graph dir- command:

    Code:
    . graph dir
        altersoft datatype importance importance2 orgtype satis startyear userrole
    
    . return list
    
    macros:
        r(list) : "altersoft datatype importance importance2 orgtype satis startyear userrole "

    However the result of the -graph dir- is sorted alphabetically.
    I'd like to get the list in the same order the graphs' tabs are appearing in the graphs viewer.

    I see the -graph dir- refers to a property .graphlist of system object ._Gr_Global, but this property has the list of graphs already sorted.

    I understand that there is a workaround to have a global and accumulate graphs names there as they are built. I'd like to avoid that at the moment.

    Is there any way to get the list of graphs in order of tabs?

    Thank you,
    Sergiy Radyakin

  • #2
    Can't you drag around tabs in the Graph Editor, making the order of appearance "fragile" in that sense? I'm curious why you need to the order of creation (but then also don't want to manually track it) ?

    Edit: Another manual tracking option is to push the graph name into a text file, one per line, treating the file like a stack that you can push/pop from.

    Comment


    • #3
      I'm curious why you need to the order of creation (but then also don't want to manually track it) ?
      By the time my code is run, the analytical results are already produced and need to be picked up. I am not always able to intervene into the user's code to record something to be used later.

      There is a million ways of recording something: file, global, stack, frame, mata object, whatever. But it doesn't solve the question of how do I read the graphs in order that they appear in the tabs.

      Thank you, Sergiy

      Comment

      Working...
      X