help shapesgraphfunctions (GitHub)

shapes

: A program for generating, transforming, and calculating features of shapes.

Notes:
1. shape can also be used as a substitute for shapes.
2. All shapes start at the 3 o' clock position (Stata default) relative to the origin.
3. All shapes are drawn counter-clockwise. Option flip can be used to change the drawing orientation in some cases.
4. The default origin is (0,0).
5. Rotation is always around the origin.
6. Positive rotation values will result in counter-clockwise adjustments (Stata default). Negative angles are therefore clockwise.
7. Each shape will generate four variables _x, _y, _order, and _id. These represent the coordinates, point order, and shape identifier respectively.

This program is currenly beta and does not have all the checks.

Syntax

Generating shapes:

shapes circle, [ circle_options common_options ]

shapes pie, [ pie_options common_options ]

shapes square, [ square_options common_options ]

Transforming shapes:

shapes rotate y x, rotate(degrees) [ rotate_options ]

Calculating shape features:

shapes area y x, by(variable) [ area_options ]

circle_options

radius(num) Specify the radius length. Default is rad(10).

n(int) Number of points to evaluate for the shape. Default is n(100). Smaller values, e.g. n(6) will generate a hexagon.

rotate(degrees) Rotate the shape counter-clockwise by degrees. Default is ro(0).

x0(num), y0(num) Center points. Defaults are x0(0) and y0(0).

pie_options

start(degrees) Starting angle of the pie arc. Default is start(0).

end(degrees) Ending angle of the pie arc. Default is end(30).

radius(num) Specify the radius length. Default is rad(10).

n(int) Number of points to evaluate for the arc. Default is n(30).

rotate(degrees) Rotate the shape by degrees. Default is ro(0).

x0(num), y0(num) Points of the arc origin. Defaults are x0(0) and y0(0).

dropbase Drop the pie starting values (x0,y0), or, just generate an arc.

flip Flips the drawing direction to clockwise.

square_options

x0(num), y0(num) Center points. Defaults are x0(0) and y0(0).

length(num) Specify the square edge length. Default is len(10).

rotate(degrees) Rotate the shape by degrees at the center. Default is ro(0).

common_options

genx(newvar), geny(newvar) Custom names for the _x and _y variables.

genorder(newvar) Custom name for the _order variable.

genid(newvar) Custom name for the _id variable.

stack or append Append the shape variables. Can be used for generating a set of shapes.

replace Replace the variables.

rotate_options

shapes rotate y x, rotate(degrees) Minimum required syntax.

rotate(degrees) Rotate the shape by degrees at the center. Default is ro(30).

x0(num), y0(num) Rotation points. Defaults are x0(0) and y0(0).

center Rotate on the mean of varlist variables.

by(variable) Rotate each by() level individual. Can only be combined with center.

genx(newvar), geny(newvar) Custom names for the _x and _y variables.

area_options

shapes area y x, by(var) Minimum required syntax.

by(variable) Generate areas using . For default variable names, this is the by(_id) variable.

generate(newvar) Custom name for the _area variable.

Examples

Please see GitHub for a comprehensive set of examples.

Circles:
shape circle, n(8) ro(22.5) rad(8) replace
twoway (connected _y _x), xsize(1) ysize(1) aspect(1) xlabel(-10 10) ylabel(-10 10)

Pies:
shape pie, start(0) end(60) ro(30) rad(8) replace
twoway (area _y _x, fcolor(%90) cmissing(n) nodropbase), xsize(1) ysize(1) aspect(1) xlabel(-10 10) ylabel(-10 10)

Package details

Version : shapes v1.3 in graphfunctions
This release : 05 Nov 2024
First release: 11 Oct 2024
Repository : GitHub
Keywords : Stata, graph, shapes
License : MIT

Author : Asjad Naqvi
E-mail : asjadnaqvi@gmail.com
Twitter/X : @AsjadNaqvi

Feedback

Please submit bugs, errors, feature requests on GitHub by opening a new issue.

Citation guidelines

See graphfunctions.

Other packages

arcplot, alluvial, bimap, bumparea, bumpline, circlebar, circlepack, clipgeo, delaunay, graphfunctions, joyplot,
marimekko, polarspike, sankey, schemepack, spider, splinefit, streamplot, sunburst, ternary, treecluster, treemap, trimap, waffle

or visit GitHub.