Skip to content

Commit

Permalink
v1.61
Browse files Browse the repository at this point in the history
  • Loading branch information
asjadnaqvi committed Jan 15, 2024
1 parent 87298f2 commit f70475f
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 26 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.6
date-released: 2023-10-15
version: 1.61
date-released: 2024-01-15
url: "https://github.com/asjadnaqvi/stata-streamplot"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Asjad Naqvi
Copyright (c) 2024 Asjad Naqvi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

---

# streamplot v1.6
(15 Oct 2023)
# streamplot v1.61
(15 Jan 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 @@ -24,7 +24,7 @@ SSC (**v1.51**):
ssc install streamplot, replace
```

GitHub (**v1.6**):
GitHub (**v1.61**):

```
net install streamplot, from("https://raw.githubusercontent.com/asjadnaqvi/stata-streamplot/main/installation/") replace
Expand Down Expand Up @@ -65,7 +65,7 @@ The syntax for the latest version is as follows:
```
streamplot y x [if] [in], by(varname)
[ palette(str) smooth(num) labcond(str) offset(num) alpha(num) droplow yreverse cat(varname) recenter(top|mid|bot)
lcolor(str) lwidth(str) ylabsize(num) ylabcolor(color|palette) percent format(str) nolabel
lcolor(str) lwidth(str) labsize(num) labcolor(color|palette) percent format(str) nolabel
xlabel(str) xtitle(str) ytitle(str) title(str) subtitle(str) note(str)
ysize(num) xsize(num) scheme(str) aspect(str) name(str) saving(str)
]
Expand Down Expand Up @@ -241,6 +241,10 @@ Please open an [issue](https://github.com/asjadnaqvi/stata-streamplot/issues) to

## Change log

**v1.61 (15 Jan 2024)**
- Fixed issues with locals.
- Change `ylabcolor()` and `ylabsize()` to just `labcolor()` and `labsize()` respectively.

**v1.6 (15 Oct 2023)**
- Major update with the `cat()` option added to compare top versus bottom streams.
- Option `yreverse` fixed.
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.6
v 1.61
d STREAMPLOT: A package for creating stream plots in Stata
d
d Asjad Naqvi,
d [email protected]
d
d Distribution-Date: 20231015
d Distribution-Date: 20240115
d
d https://medium.com/the-stata-guide
d https://github.com/asjadnaqvi/Stata-schemes
Expand Down
15 changes: 8 additions & 7 deletions installation/streamplot.ado
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*! streamplot v1.6 (15 Oct 2023)
*! streamplot v1.61 (15 Jan 2024)
*! Asjad Naqvi ([email protected])

* v1.61 (15 Jan 2024): fixed wrong locals. changed ylab to just lab.
* v1.6 (15 Oct 2023): cat() option added. yrev, labcond() fixed. major code cleanup.
* v1.52 (25 Aug 2023): Support for aspect(), saving(), nolabel, nodraw, xscale() and graphregion() added.
* v1.51 (28 May 2023): Clean up labcond and offset changes to percentages.
Expand All @@ -21,7 +22,7 @@ version 15
syntax varlist(min=2 max=2 numeric) [if] [in], by(varname) ///
[ palette(string) alpha(real 100) smooth(real 3) ] ///
[ LColor(string) LWidth(string) labcond(real 0) ] ///
[ YLABSize(string) YLABel(varname) YLABColor(string) offset(real 15) ] ///
[ LABSize(string) LABColor(string) offset(real 15) ] ///
[ xlabel(passthru) xtitle(passthru) title(passthru) subtitle(passthru) note(passthru) scheme(passthru) name(passthru) xsize(passthru) ysize(passthru) ] ///
[ PERCENT FORMAT(string) RECenter(string) ] ///
[ aspect(passthru) saving(passthru) NOLABel nodraw xscale(passthru) graphregion(passthru) ] /// v1.5x
Expand Down Expand Up @@ -225,7 +226,7 @@ preserve

gen _stack0 = 0 // we need this for area graphs

order date _stack0
order `xvar' _stack0


if `rebasecat' == 0 {
Expand Down Expand Up @@ -322,10 +323,10 @@ preserve



if "`ylabsize'" == "" local ylabsize "1.4"
if "`labsize'" == "" local labsize 1.6
if "`lcolor'" == "" local lcolor white
if "`lwidth'" == "" local lwidth 0.05
if "`ylabcolor'" != "palette" local ycolor `ylabcolor'
if "`labcolor'" != "palette" local ycolor `labcolor'
if "`palette'" == "" {
local palette tableau
}
Expand Down Expand Up @@ -385,13 +386,13 @@ summ _stack0_norm, meanonly
local areagraph `areagraph' rarea _stack`x0'_norm _stack`x1'_norm `xvar', fcolor("`r(p`x1')'") fi(100) lcolor(`lcolor') lwidth(`lwidth') ||


if "`ylabcolor'" == "palette" {
if "`labcolor'" == "palette" {
local ycolor "`r(p`x1')'"
}


if "`nolabel'"=="" {
local labels `labels' (scatter _ylab`x1' `xvar' if last==1, mlabel(_label`x1') mcolor(none) mlabsize(`ylabsize') mlabcolor("`ycolor'")) ||
local labels `labels' (scatter _ylab`x1' `xvar' if last==1, mlabel(_label`x1') mcolor(none) mlabsize(`labsize') mlabcolor("`ycolor'")) ||

}

Expand Down
4 changes: 2 additions & 2 deletions installation/streamplot.pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v 1.6
v 1.61
d {bf:STREAMPLOT}: A package for creating streamplots in Stata
d
d Requires: Stata version 15 or higher.
Expand All @@ -9,7 +9,7 @@ d KW: streamplot
d
d Distribution-Date: 20231015
d
d This version: 15 Oct 2023
d This version: 15 Jan 2024
d First version: 05 Dec 2021
d License: MIT
d
Expand Down
16 changes: 8 additions & 8 deletions installation/streamplot.sthlp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{smcl}
{* 15Oct2023}{...}
{* 15Jan2024}{...}
{hi:help streamplot}{...}
{right:{browse "https://github.com/asjadnaqvi/stata-streamplot":streamplot v1.6 (GitHub)}}
{right:{browse "https://github.com/asjadnaqvi/stata-streamplot":streamplot v1.61 (GitHub)}}

{hline}

Expand All @@ -16,7 +16,7 @@ The command is based on the following guide on Medium: {browse "https://medium.c

{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}(top|mid|bot)
{cmdab:lc:olor}({it:str}) {cmdab:lw:idth}({it:str}) {cmdab:ylabs:ize}({it:num}) {cmdab:ylabc:olor}({it:color}|{it:palette}) {cmd:percent} {cmd:format}({it:str}) {cmdab:nolab:el}
{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:nolab:el}
{cmd:xlabel}({it:str}) {cmd:xtitle}({it:str}) {cmd:ytitle}({it:str}) {cmd:title}({it:str}) {cmd:subtitle}({it:str}) {cmd:note}({it:str})
{cmd:ysize}({it:num}) {cmd:xsize}({it:num}) {cmd:scheme}({it:str}) {cmd:aspect}({it:str}) {cmd:name}({it:str}) {cmd:saving}({it:str})
{cmd:]}
Expand Down Expand Up @@ -57,10 +57,10 @@ 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 ylabc:olor(str)}}Either takes on a named Stata color, e.g. {opt ylabc(red)} for red labels.
If {it:ylabc(palette)} is specified, labels are colored based on the color palette.{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}

{p2coldent : {opt ylabs:ize(str)}}Size of the stream labels. Default value is {opt ylabs(1.4)}.{p_end}
{p2coldent : {opt labs:ize(str)}}Size of the stream labels. Default value is {opt labs(1.4)}.{p_end}

{p2coldent : {opt percent}}Shows the percentage share for the y-axis categories.{p_end}

Expand Down Expand Up @@ -103,8 +103,8 @@ See {browse "https://github.com/asjadnaqvi/stata-streamplot":GitHub}.

{title:Package details}

Version : {bf:streamplot} v1.6
This release : 15 Oct 2023
Version : {bf:streamplot} v1.61
This release : 15 Jan 2024
First release: 06 Aug 2021
Repository : {browse "https://github.com/asjadnaqvi/stata-streamplot":GitHub}
Keywords : Stata, graph, stream plot
Expand Down

0 comments on commit f70475f

Please sign in to comment.