Skip to content

Commit

Permalink
v1.32
Browse files Browse the repository at this point in the history
  • Loading branch information
asjadnaqvi committed Jun 12, 2024
1 parent a4a212c commit d3de344
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ authors:
- family-names: "Naqvi"
given-names: "Asjad"
title: "Stata package ``spider''"
version: 1.31
version: 1.32
date-released: 2024-05-11
url: "https://github.com/asjadnaqvi/stata-spider"
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![StataMin](https://img.shields.io/badge/stata-2015-blue) ![issues](https://img.shields.io/github/issues/asjadnaqvi/stata-spider) ![license](https://img.shields.io/github/license/asjadnaqvi/stata-spider) ![Stars](https://img.shields.io/github/stars/asjadnaqvi/stata-spider) ![version](https://img.shields.io/github/v/release/asjadnaqvi/stata-spider) ![release](https://img.shields.io/github/release-date/asjadnaqvi/stata-spider)

[Installation](#Installation) | [Syntax](#Syntax) | [Examples](#Examples) | [Feedback](#Feedback) | [Change log](#Change-log)
[Installation](#Installation) | [Syntax](#Syntax) | [Citation guidelines](#Citation-guidelines) | [Examples](#Examples) | [Feedback](#Feedback) | [Change log](#Change-log)


---
Expand All @@ -9,8 +9,8 @@



# spider v1.31
(11 May 2024)
# spider v1.32
(11 Jun 2024)

This package provides the ability to draw spiders Stata. It is based on the [Spider plots](https://medium.com/the-stata-guide/stata-graphs-spider-plots-613808b51f73) guide on Medium

Expand All @@ -24,7 +24,7 @@ The SSC version (**v1.31**):
ssc install spider, replace
```

Or it can be installed from GitHub (**v1.31**):
Or it can be installed from GitHub (**v1.32**):

```
net install spider, from("https://raw.githubusercontent.com/asjadnaqvi/stata-spider/main/installation/") replace
Expand Down Expand Up @@ -63,7 +63,7 @@ The syntax for the latest version is as follows:
```stata
spider var [if] [in], by(var)
[ over(var) alpha(num 0-100) rotate(num) smooth(num 0-1) palette(str) range(min max) cuts(num) lwidth(str) msymbol(str) rotatelabel
format(fmt) ralabsize(str) ralabcolor(str) ralabangle(str) msize(str) mlwidth(str) displacelab(num) displacespike(num)
format(fmt) ralabsize(str) ralabcolor(str) ralabangle(str) msize(str) mlwidth(str) displacelab(num) displacespike(num) wrap(num)
ccolor(str) cwidth(str) scolor(str) swidth(str) slabsize(str) slabcolor(str) nolegend legpositon(num) legpositon(num) legcolumns(num) legsize(num)
xsize(num) ysize(num) *
]
Expand All @@ -80,6 +80,31 @@ spider numeric variables, over(category variable)
where `numeric variables` are a set of variables where each corresponds to a spider plot, and `over()` defines the categories.


## Citation guidelines
Software packages take countless hours of programming, testing, and bug fixing. If you use this package, then a citation would be highly appreciated. Suggested citations:

*in BibTeX*

```
@software{spider,
author = {Naqvi, Asjad},
title = {Stata package ``spider''},
url = {https://github.com/asjadnaqvi/stata-spider},
version = {1.32},
date = {2024-06-11}
}
```

*or simple text*

```
Naqvi, A. (2024). Stata package "spider" version 1.32. Release date 11 June 2024. https://github.com/asjadnaqvi/stata-spider.
```


*or see [SSC citation](https://ideas.repec.org/c/boc/bocode/s459136.html) (updated once a new version is submitted)*


## Examples

Set up the data:
Expand Down Expand Up @@ -268,6 +293,9 @@ Please open an [issue](https://github.com/asjadnaqvi/stata-spider/issues) to rep

## Change log

**v1.32 (11 Jun 2024)**
- Added `wrap()` to wrap labels.

**v1.31 (11 May 2024)**
- changed `raformat()` to just `format()` to standardize the use across packages.
- `format()` default improved to show decimals.
Expand Down
33 changes: 24 additions & 9 deletions installation/spider.ado
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*! spider v1.31 (11 May 2024)
*! spider v1.32 (11 Jun 2024)
*! Asjad Naqvi (asjadnaqvi@gmail.com)


* v1.32 (11 Jun 2024): add wrap() for label wraps
* v1.31 (11 May 2024): changed raformat() to format(). Format default improved. by() and over() error checks added. passthru changed to *.
* v1.3 (16 Feb 2024): rewrite to suport long form, add rotate label, better legend controls.
* v1.23 (12 Nov 2023): Added slabcolor(), saving()
Expand Down Expand Up @@ -30,7 +32,7 @@ version 15
[ CColor(string) CWidth(string) SColor(string) SWidth(string) SLABSize(string) ] /// // circle = C, spikes = S
[ NOLEGend LEGPOSition(real 6) LEGCOLumns(real 3) LEGSize(real 2.2) ] /// // v1.2 updates.
[ RALABColor(string) RALABAngle(string) SLABColor(string) ROTATELABel ] /// // v1.2X options
[ xsize(real 1) ysize(real 1) * ]
[ xsize(real 1) ysize(real 1) wrap(numlist >=0 max=1) * ]


// check dependencies
Expand Down Expand Up @@ -200,7 +202,7 @@ preserve
forval x = 0(`gap')100 {
local circle `circle' (function sqrt(`x'^2 - x^2), lc(`ccolor') lw(`cwidth') lp(solid) range(-`x' `x') n(`sides')) || (function -sqrt(`x'^2 - x^2), lc(`ccolor') lw(`cwidth') lp(solid) range(-`x' `x') n(`sides')) ||

}
}

///////////////////////
// circle labels //
Expand Down Expand Up @@ -249,7 +251,7 @@ preserve
// labels //
/////////////////

if "`slabsize'" == "" local slabsize 2.2
if "`slabsize'" == "" local slabsize 2.2
if "`slabcolor'" == "" local slabcolor black

gen double markerx = .
Expand All @@ -266,17 +268,29 @@ preserve

local varn : label `by' `i'
replace markerlab = "`varn'" in `i'

}

if "`wrap'" != "" {
gen _length = length(markerlab) if markerlab!= ""
summ _length, meanonly
local _wraprounds = floor(`r(max)' / `wrap')

forval i = 1 / `_wraprounds' {
local wraptag = `wrap' * `i'
replace markerlab = substr(markerlab, 1, `wraptag') + "`=char(10)'" + substr(markerlab, `=`wraptag' + 1', .) if _length > `wraptag' & _length!=.
}
drop _length
}


forval i = 1/`byitems' {
if "`rotatelabel'" != "" {
sum angle in `i', meanonly
local angle = (r(mean) * (180 / _pi)) - 90
}


local labs `labs' (scatter markery markerx in `i', mc(none) mlab("markerlab") mlabpos(0) mlabcolor(`slabcolor') mlabangle(`angle') mlabsize(`slabsize')) /// //
local labs `labs' (scatter markery markerx in `i', mc(none) mlab("markerlab") mlabpos(0) mlabcolor(`slabcolor') mlabangle(`angle') mlabsize(`slabsize'))



}

/////////////////
Expand Down Expand Up @@ -522,6 +536,7 @@ restore

end


*********************************
******** END OF PROGRAM *********
*********************************
Expand Down
6 changes: 3 additions & 3 deletions installation/spider.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v 1.31
v 1.32
d {bf:SPIDER}: A Stata package for spider plots.
d See {bf:help spider} after installation.
d
Expand All @@ -9,9 +9,9 @@ d KW: graphs
d KW: spider plot
d
d
d Distribution-Date: 20240216
d Distribution-Date: 20240611
d
d This version: 11 May 2024
d This version: 11 Jun 2024
d First version: 13 Oct 2022
d License: MIT
d
Expand Down
44 changes: 32 additions & 12 deletions installation/spider.sthlp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{smcl}
{* 11May2024}{...}
{* 11Jun2024}{...}
{hi:help spider}{...}
{right:{browse "https://github.com/asjadnaqvi/stata-spider":spider v1.31 (GitHub)}}
{right:{browse "https://github.com/asjadnaqvi/stata-spider":spider v1.32 (GitHub)}}

{hline}

Expand All @@ -16,11 +16,10 @@ The command is based on the following guide on Medium: {browse "https://medium.c
{cmd:spider} {it:var} {ifin}, {cmd:by}({it:var})
{cmd:[} {cmd:over}({it:var}) {cmd:alpha}({it:num 0-100}) {cmdab:ro:tate}({it:num}) {cmd:smooth}({it:num 0-1}) {cmd:palette}({it:str})
{cmdab:ra:nge}({it:min max}) {cmd:cuts}({it:num}) {cmdab:lw:idth}({it:str}) {cmdab:msym:bol}({it:str}) {cmdab:rotatelab:el}
{cmd:format}({it:fmt}) {cmdab:ralabs:ize}({it:str}) {cmdab:ralabc:olor}({it:str}) {cmdab:ralaba:ngle}({it:str})
{cmd:format}({it:fmt}) {cmdab:ralabs:ize}({it:str}) {cmdab:ralabc:olor}({it:str}) {cmdab:ralaba:ngle}({it:str}) {cmd:wrap}({it:num})
{cmdab:ms:ize}({it:str}) {cmdab:mlw:idth}({it:str}) {cmdab:displacel:ab}({it:num}) {cmdab:displaces:pike}({it:num})
{cmdab:cc:olor}({it:str}) {cmdab:cw:idth}({it:str}) {cmdab:sc:olor}({it:str}) {cmdab:sw:idth}({it:str}) {cmdab:slabs:ize}({it:str}) {cmdab:slabc:olor}({it:str})
{cmdab:noleg:end} {cmdab:legpos:iton}({it:num}) {cmdab:legpos:iton}({it:num}) {cmdab:legcol:umns}({it:num}) {cmdab:legs:ize}({it:num}) {cmd:xsize}({it:num}) {cmd:ysize}({it:num})
{cmd:title}({it:str}) {cmd:subtitle}({it:str}) {cmd:note}({it:str}) {cmd:scheme}({it:str}) {cmd:name}({it:str}) {cmd:saving}({it:str})
{cmdab:noleg:end} {cmdab:legpos:iton}({it:num}) {cmdab:legpos:iton}({it:num}) {cmdab:legcol:umns}({it:num}) {cmdab:legs:ize}({it:num}) {cmd:xsize}({it:num}) {cmd:ysize}({it:num}) *
{cmd:]}

{p 4 4 2}
Expand Down Expand Up @@ -61,6 +60,8 @@ Please keep this in mind when defining this option.{p_end}
{p2coldent : {opt format(fmt)}}Format the values of the data range. The default format is {opt format(%12.1f)}.
If your data ranges has decimal values, then it is advised to change the display to a reasonable format.{p_end}

{p2coldent : {opt wrap(num)}}Wrap the labels after a number of characters. A good starting point for very long labels is {opt wrap(50)}.{p_end}

{p2coldent : {opt ralabs:ize(str)}}The size of the range labels. The default format is {opt ralabs(1.8)}.{p_end}

{p2coldent : {opt ralabc:olor(str)}}The color of the range labels. The default format is {opt ralabc(black)}.{p_end}
Expand All @@ -73,6 +74,8 @@ Area fill lines can be turned off by defining {opt lw(none)}.{p_end}
{p2coldent : {opt msym:bol(str)}}The marker symbol on the spider lines. Default is {opt msym(circle)}.
Markers can be turned off by defining {opt msymb(none)}.{p_end}

{p2coldent : {opt wrap(num)}}Wrap the labels after a number of characters. For example, {opt wrap(50)} will wrap labels every 50 characters.{p_end}

{p2coldent : {opt ms:ize(str)}}The marker size on the spider lines. Default is {opt ms(0.3)}.{p_end}

{p2coldent : {opt mlw:idth(str)}}The marker line size on the spider lines. Default is {opt mlw(0.3)}.
Expand Down Expand Up @@ -107,11 +110,7 @@ The default value is {opt displaces(2)} for 2%.{p_end}

{p2coldent : {opt xsize(num)}, {opt ysize(num)}}Dimensions of the graph. Defaults are {opt xsize(1)} and {opt ysize(1)}.{p_end}

{p2coldent : {opt title}, {opt subtitle}, {opt note}}These are standard twoway graph options.{p_end}

{p2coldent : {opt scheme(string)}}Load the custom scheme. Above options can be used to fine tune individual elements.{p_end}

{p2coldent : {opt name(string)}}Assign a name to the graph.{p_end}
{p2coldent : {opt *}}All other standard twoway options.{p_end}

{synoptline}
{p2colreset}{...}
Expand All @@ -134,8 +133,8 @@ See {browse "https://github.com/asjadnaqvi/stata-spider":GitHub} for examples.

{title:Package details}

Version : {bf:spider} v1.31
This release : 11 May 2024
Version : {bf:spider} v1.32
This release : 11 Jun 2024
First release: 13 Oct 2022
Repository : {browse "https://github.com/asjadnaqvi/stata-spider":GitHub}
Keywords : Stata, graph, spider plot
Expand All @@ -158,9 +157,30 @@ Please submit bugs, errors, feature requests on {browse "https://github.com/asja
{p 4 8 2}Jann, B. (2022). {browse "https://ideas.repec.org/p/bss/wpaper/43.html":Color palettes for Stata graphics: An update}. University of Bern Social Sciences Working Papers No. 43.


{title:Feedback}

Please submit bugs, errors, feature requests on {browse "https://github.com/asjadnaqvi/stata-spider/issues":GitHub} by opening a new issue.


{title:Citation guidelines}

Suggested citation guidlines for this package:

Naqvi, A. (2024). Stata package "spider" version 1.32. Release date 11 June 2024. https://github.com/asjadnaqvi/stata-spider.

@software{spider,
author = {Naqvi, Asjad},
title = {Stata package ``spider''},
url = {https://github.com/asjadnaqvi/stata-spider},
version = {1.32},
date = {2024-06-11}
}


{title:Other visualization packages}

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

or visit {browse "https://github.com/asjadnaqvi":GitHub} for detailed documentation and examples.
4 changes: 2 additions & 2 deletions installation/stata.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
v 1.31
v 1.32
d 'SPIDER': A Stata package for spider plots
d
d Distribution-Date: 20240511
d Distribution-Date: 20241011
d
d Asjad Naqvi
d asjadnaqvi@gmail.com
Expand Down

0 comments on commit d3de344

Please sign in to comment.