help polarspikepolarspike v1.0 (GitHub)

polarspike

: A Stata package for polar spike graphs.

Syntax

polarspike var [if] [in], by(var1) [ over(var2) ]
[ radmin(num) radmax(num) rotate(num) gap(num) palette(str) lwidth(str) format(str)
labcolor(str) labgap(num) labsize(str) ocolor(str) ogap(num) osize(str)
nolegend legsize(str) legposition(str) legcolumns(num) *
]

polarspike var, by(var1) over(var2) The minimum syntax requires defining a numerical var variable. The placement around the circle is determined by the by(var1) variable.
The spikes can be grouped by the over(var2) variable. If there is more data than is required, then the program will collapse the data using the sum value of the var by var1() and var2().
If you want other ways of summarizing the variables, then it is highly recommended to prepare the data beforehand.

radmin(num) radmax(num) The spikes are scaled between a minimum and a maximum radius defined by radmin() and radmax() respectively.
radmin() can be set to 0 to start from the origin. Default values are radmin(5) and radmax(10).

rotate(num) Rotate the whole graph by num degrees. For example, ro(30) is a 30 degree anti-clockwise rotation. Default is ro(0).

gap(num) A gap in degrees between the spike groups defined by over(). For example, gap(2) will space the spikes by 2 degrees. Default is gap(5).

palette(str) Color name is any named scheme defined in the colorpalette package. Default is tableau.

colorby(var) Color spikes by the colorby(var). This option only works if over() is not specified. This will also automatically enable the legend.

format(str) Format the values of the spike labels category. Default value is format(%15.0f).

lwidth(str) Line width of the spikes. Default value is lw(0.6). Depending on the number of spikes on the graph, this might need to be adjusted.

offset(num) Offset the axes for a percentage of the maximum extent. Default is offset(5) for 5%.

labgap(num) Gap of the spike labels. Default value is labg(5) for 5% of the radius of the largest slice.

labsize(str) Size of the spike labels. Default value is labs(1.1).

labcolor(str) Color of the spike labels. Default value is labc(black).

labcondition(num) Values less than are not shown. Default is a very large negative value.

ogap(num) Gap of the over() categories. Default value is ogap(0.9) or 90% of the radmin() value.

osize(str) Size of the over() categories. Default value is osize(1.1).

ocolor(str) Color of the over() labels. Default value is ocolor(black).

legcolumns(num) Number of legend rows. Default is legcol(3).

legsize(str) Size of legend entries. Default is legs(1.5).

legposition(str) Position of legend. Default is legpos(6) for 6 o' clock.

nolegend Turn off the legend.

* All other standard twoway options unless overwritten by the program.

Dependencies

The palette package (Jann 2018, 2022) is required:

ssc install palettes, replace
ssc install colrspace, replace

Even if you have these installed, it is highly recommended to update the dependencies:
ado update, update

Examples

See GitHub.

Package details

Version : polarspike v1.0
This release : 09 May 2024
First release: 09 May 2024
Repository : GitHub
Keywords : Stata, polar spike graphs
License : MIT

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

Feedback

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

References

Jann, B. (2018). Color palettes for Stata graphics. The Stata Journal 18(4): 765-785.

Jann, B. (2022). Color palettes for Stata graphics: an update. University of Bern Social Sciences Working Papers No. 43.

Other visualization packages

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