Announcement

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

  • webdoc using loops into heading

    Dear all,
    I am just starting to use webdoc and I find this tool powerful.
    I need to make a lot of graphics and to do so I make loops. And to scroll over the graphics quickly I wa,t to use the table of contents.
    But until now I did not manage to combine heading and loops.

    I just wrote a fake example were you could test and help me if you find a trick.

    A long time ago I found a ggvis tool for stata but then it disappeared so I can't find a way to have interactive graphics. (as in Shiny R)

    Thanks in advance ...

    Code:
    webdoc init, header(width(700px))
    webdoc toc 3
    /***
    <h1>h1 heading</h1>
    <h2>h2 heading</h2>
    <h3>h3 heading</h3>
    ***/
    
    local liste_toloop "a b c d"
    
    webdoc stlog
    foreach gr of local liste_toloop {
    
    /***
    webdoc put <h2>Ici `gr'</h2>
    displays a scatter plot of price by milage. </p>
    ***/
        sysuse auto
        twoway (scatter price mpg)
    webdoc stlog close
    webdoc graph, figure(gr-`gr') caption(Figure `gr') cabove
    
    /*** <p> To further analyze the relation between price by milage, we can
    add a linear fit to the plot ***/
    
    }
Working...
X