Skip to content

Commit

Permalink
v1.82
Browse files Browse the repository at this point in the history
  • Loading branch information
asjadnaqvi committed Jun 11, 2024
1 parent 02491cd commit 9461606
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 23 deletions.
4 changes: 2 additions & 2 deletions 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 ``streamplot''"
version: 1.81
date-released: 2024-04-30
version: 1.82
date-released: 2024-06-10
url: "https://github.com/asjadnaqvi/stata-streamplot"
42 changes: 38 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

---

[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)

---

![StataMin](https://img.shields.io/badge/stata-2015-blue) ![issues](https://img.shields.io/github/issues/asjadnaqvi/stata-streamplot) ![license](https://img.shields.io/github/license/asjadnaqvi/stata-streamplot) ![Stars](https://img.shields.io/github/stars/asjadnaqvi/stata-streamplot) ![version](https://img.shields.io/github/v/release/asjadnaqvi/stata-streamplot) ![release](https://img.shields.io/github/release-date/asjadnaqvi/stata-streamplot)


# streamplot v1.81
(30 Apr 2024)
# streamplot v1.82
(10 Jun 2024)

This package provides the ability to generate stream plots in Stata. It is based on the [Streamplot Guide](https://medium.com/the-stata-guide/covid-19-visualizations-with-stata-part-10-stream-graphs-9d55db12318a) (December 2020).

Expand All @@ -25,7 +25,7 @@ SSC (**v1.81**):
ssc install streamplot, replace
```

GitHub (**v1.81**):
GitHub (**v1.82**):

```
net install streamplot, from("https://raw.githubusercontent.com/asjadnaqvi/stata-streamplot/main/installation/") replace
Expand Down Expand Up @@ -78,6 +78,36 @@ streamplot y x, by(varname)
where `y` is the variable we want to plot, and `x` is usually the time dimension. The `by` variable splits the data into different groupings that also determines the colors. The color schemes can be modified using the `palettes(name)` option. Here any scheme from the `colorpalettes` package can be used.


## 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{streamplot,
author = {Naqvi, Asjad},
title = {Stata package ``streamplot''},
url = {https://github.com/asjadnaqvi/stata-streamplot},
version = {1.82},
date = {2024-06-10}
}
```

*or simple text*

```
Naqvi, A. (2024). Stata package "streamplot" version 1.82. Release date 10 June 2024. https://github.com/asjadnaqvi/stata-streamplot.
```


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

```
Asjad Naqvi, 2022. "SANKEY: Stata module for Sankey diagrams," Statistical Software Components S459154, Boston College Department of Economics, revised 17 May 2024.
```



## Examples

Expand Down Expand Up @@ -344,6 +374,10 @@ Please open an [issue](https://github.com/asjadnaqvi/stata-streamplot/issues) to

## Change log

**v1.82 (10 Jun 2024)**
- Added `wrap()` option for label wrapping.
- Minor code fixes.

**v1.81 (30 Apr 2024)**
- Added `area` option to allow stacked area graphs.

Expand Down
4 changes: 2 additions & 2 deletions installation/stata.toc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
v 1.81
v 1.82
d STREAMPLOT: A package for creating stream plots in Stata
d
d Asjad Naqvi,
d [email protected]
d
d Distribution-Date: 20240430
d Distribution-Date: 20240610
d
d https://medium.com/the-stata-guide
d https://github.com/asjadnaqvi/Stata-schemes
Expand Down
20 changes: 17 additions & 3 deletions installation/streamplot.ado
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
*! streamplot v1.81 (30 Apr 2024)
*! streamplot v1.82 (10 Jun 2024)
*! Asjad Naqvi ([email protected])

* v1.81 (30 Apr 2024): added area option to creat
* v1.82 (10 Jun 2024): add wrap() for label wraps.
* v1.81 (30 Apr 2024): added area option to create stacked area plots.
* v1.8 (25 Apr 2024): added labscale option. Added percent/share as substitutes. more flexible for generic options.
* v1.7 (01 Apr 2024): trendline, yline, drop if by() is missing
* v1.61 (15 Jan 2024): fixed wrong locals. changed ylab to just lab.
Expand All @@ -28,7 +29,7 @@ version 15
[ NOLABel nodraw ] /// v1.5x
[ cat(varname) YREVerse ] /// // v1.6
[ tline TLColor(string) TLWidth(string) TLPattern(string) droplow ] /// // v1.7
[ * labprop labscale(real 0.3333) percent share area ] // 1.8 options
[ * labprop labscale(real 0.3333) percent share area wrap(numlist >=0 max=1) ] // 1.8 options


// check dependencies
Expand Down Expand Up @@ -352,6 +353,19 @@ preserve
else {
gen _label = _yname + " (" + string(_yval, "`format'") + ")" if _yval!=. //if last==1 & `labvar' >= `labcond'
}

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

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

drop _length
}


if "`labsize'" == "" local labsize 1.6
Expand Down
6 changes: 3 additions & 3 deletions installation/streamplot.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v 1.81
v 1.82
d {bf:STREAMPLOT}: A package for creating streamplots in Stata
d
d Requires: Stata version 15 or higher.
Expand All @@ -7,9 +7,9 @@ d KW: Stata
d KW: graphs
d KW: streamplot
d
d Distribution-Date: 20240430
d Distribution-Date: 20240610
d
d This version: 30 Apr 2024
d This version: 10 Jun 2024
d First version: 05 Dec 2021
d License: MIT
d
Expand Down
42 changes: 33 additions & 9 deletions installation/streamplot.sthlp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{smcl}
{* 30Apr2024}{...}
{* 10Jun2024}{...}
{hi:help streamplot}{...}
{right:{browse "https://github.com/asjadnaqvi/stata-streamplot":streamplot v1.81 (GitHub)}}
{right:{browse "https://github.com/asjadnaqvi/stata-streamplot":streamplot v1.82 (GitHub)}}

{hline}

Expand All @@ -15,9 +15,10 @@ The command is based on the following guide on Medium: {browse "https://medium.c
{p 8 15 2}

{cmd:streamplot} {it:y x} {ifin}, {cmd:by}(varname)
{cmd:[} {cmd:palette}({it:str}) {cmd:smooth}({it:num}) {cmd:labcond}({it:str}) {cmd:offset}({it:num}) {cmd:alpha}({it:num}) {cmd:droplow} {cmdab:yrev:erse} {cmd:cat}({it:varname}) {cmdab:rec:enter}({it:top}|{it:mid}|{it:bot})
{cmdab:lc:olor}({it:str}) {cmdab:lw:idth}({it:str}) {cmdab:labs:ize}({it:num}) {cmdab:labc:olor}({it:color}|{it:palette}) {cmd:percent} {cmd:format}({it:str}) {cmdab:area} {cmdab:nolab:el}
{cmd:tline} {cmdab:tlc:olor}({it:str}) {cmdab:tlw:idth}({it:str}) {cmdab:tlp:attern}({it:str}) {cmd:yline}({it:str}) {cmd:labprop} {cmd:labscale}({it:num}) {cmd:*}
{cmd:[} {cmd:palette}({it:str}) {cmd:smooth}({it:num}) {cmd:labcond}({it:str}) {cmd:offset}({it:num}) {cmd:alpha}({it:num}) {cmd:droplow} {cmdab:yrev:erse} {cmd:cat}({it:varname})
{cmdab:rec:enter}({it:top}|{it:mid}|{it:bot}) {cmdab:lc:olor}({it:str}) {cmdab:lw:idth}({it:str}) {cmdab:labs:ize}({it:num}) {cmdab:labc:olor}({it:color}|{it:palette})
{cmd:percent} {cmd:format}({it:str}) {cmdab:area} {cmdab:nolab:el} {cmd:wrap}({it:num}) {cmd:tline} {cmdab:tlc:olor}({it:str}) {cmdab:tlw:idth}({it:str})
{cmdab:tlp:attern}({it:str}) {cmd:yline}({it:str}) {cmd:labprop} {cmd:labscale}({it:num}) {cmd:wrap}({it:num}) {cmd:*}
{cmd:]}


Expand Down Expand Up @@ -58,6 +59,8 @@ Default is {stata colorpalette tableau:{it:tableau}}.{p_end}

{p2coldent : {opt offset(num)}}Extends the x-axis range to accommodate labels. The default value is {opt offset(15)} for 15% of {it:xmax-xmin} of the axis range.{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 labc:olor(str)}}Label colors are either defined as a single color, e.g. default is {opt labc(black)}. Or if {opt labc(palette)} is specified,
labels have the {opt palette()} colors.{p_end}

Expand Down Expand Up @@ -89,7 +92,7 @@ For example, {opt labcond(100)} will only shows labels where the last data point
{p2coldent : {opt labscale(num)}}Scale factor of {opt labprop}. Default value is {opt labscale(0.3333)}. Values closer to zero result in more exponential scaling, while values closer
to one are almost linear scaling. This is an advanced option so use carefully.{p_end}

{p2coldent : {opt *}}All other standard twoway options unless overwritten by the program.{p_end}
{p2coldent : {opt *}}All other standard twoway options.{p_end}

{hline}

Expand All @@ -111,8 +114,8 @@ See {browse "https://github.com/asjadnaqvi/stata-streamplot":GitHub}.

{title:Package details}

Version : {bf:streamplot} v1.81
This release : 30 Apr 2024
Version : {bf:streamplot} v1.82
This release : 10 Jun 2024
First release: 06 Aug 2021
Repository : {browse "https://github.com/asjadnaqvi/stata-streamplot":GitHub}
Keywords : Stata, graph, stream plot
Expand All @@ -123,6 +126,26 @@ E-mail : [email protected]
Twitter : {browse "https://twitter.com/AsjadNaqvi":@AsjadNaqvi}


{title:Feedback}

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


{title:Citation guidelines}

Suggested citation guidlines for this package:

Naqvi, A. (2024). Stata package "streamplot" version 1.82. Release date 10 June 2024. https://github.com/asjadnaqvi/stata-streamplot.

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


{title:References}

{p 4 8 2}Jann, B. (2018). {browse "https://www.stata-journal.com/article.html?article=gr0075":Color palettes for Stata graphics}. The Stata Journal 18(4): 765-785.
Expand All @@ -134,5 +157,6 @@ Twitter : {browse "https://twitter.com/AsjadNaqvi":@AsjadNaqvi}

{psee}
{helpb arcplot}, {helpb alluvial}, {helpb bimap}, {helpb bumparea}, {helpb bumpline}, {helpb circlebar}, {helpb circlepack}, {helpb clipgeo}, {helpb delaunay}, {helpb joyplot},
{helpb marimekko}, {helpb sankey}, {helpb schemepack}, {helpb spider}, {helpb streamplot}, {helpb sunburst}, {helpb treecluster}, {helpb treemap}, {helpb waffle}
{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.

0 comments on commit 9461606

Please sign in to comment.