Skip to content

haghish/diagram

Repository files navigation

diagram : Graphviz and DOT Path Diagrams in Stata

diagram generates dynamic diagrams using DOT markup language
and exports images in pdf, png, jpeg, gif, and bmp format. For more information visit diagram homepage. It can also generate diagrams automatically from Stata data set.

Author

E. F. Haghish
Center for Medical Biometry and Medical Informatics
University of Freiburg, Germany
haghish@imbi.uni-freiburg.de
http://www.haghish.com/dot
@Haghish

Installation

The diagram package relies on webimage package for exporting the graphs to various formats. For more information regarding the latter package, visit webimage on GitHub. Both packages are installable via GitHub.

The diagram package requires webimage__ Stata package for exporting the graphical files. The github package can be used to install diagram and its dependency, webimage, as shown below:

github install haghish/diagram

Moreover, for exporting graphical files, the webimage package requires phantomJS, which is an open-source freeware available for Windows, Mac, and Linux. The path to the executable phantomJS file is required in order to export the graphical files. However, if the executable file is installed in the default local directory (e.g. /usr/local/bin/ on Mac or c:\phantomJS\bin\phantomJS.exe on Windows), the phantomjs(str) can be ignored.

Examples

The examples directory includes several examples for generating dynamic diagrams from DOT markup and Stata data sets.

Example 1

In the examples directory, there is a DOT file named PATH1.txt which draws a path diagram. The file is rendered by diagram command and exported to a PNG file directly from Stata:

diagram using "./examples/PATH1.txt", export(./examples/example1.png)