help catsplinegraphfunctions (GitHub)

catspline

: A program for generating Catmull-Rom splines.

The program inputs (x, y) numeric variables and outputs three variables (_id, _x, _y).
The _id variable represents the drawing sequence and _x, _y contains coordinates for pair-wise spline segments.

Syntax

catspline y x, [ rho(num [0,1]) n(int) close genx(newvar) geny(newvar) ]

catspline y x Input a coordinate pair.

rho(num) Smoothing parameter bounded between 0 and 1. Default is rho(0.5).

n(int) Number of points to generate for each spline. Default is n(40).

close Close the loop between the starting and the ending points.

genx(newvar) geny(newvar) Custom names for the generated x,y variables.
Defaults are _x, _y.

Examples

Generate data:
clear
set obs 5
set seed 2021
gen x = runiformint(1,5)
gen y = runiformint(1,5)

Run the program:
catspline y x, close rho(0.4)

Plot the data:
twoway (scatter y x) (line _y _x, cmissing(n))

More examples on GitHub.

Package details

Version : catspline v1.0 in graphfunctions
This release : 04 Oct 2024
First release: 04 Oct 2024
Repository : GitHub
Keywords : Stata, graph, splines, catmull rom function
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.