From f70475f600f7f66a0e1cd3dcb86063bcb89c069e Mon Sep 17 00:00:00 2001 From: Asjad Naqvi Date: Mon, 15 Jan 2024 22:36:40 +0100 Subject: [PATCH] v1.61 --- CITATION.cff | 4 ++-- LICENSE | 2 +- README.md | 12 ++++++++---- installation/stata.toc | 4 ++-- installation/streamplot.ado | 15 ++++++++------- installation/streamplot.pkg | 4 ++-- installation/streamplot.sthlp | 16 ++++++++-------- 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index b7e2326..3514ce8 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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" diff --git a/LICENSE b/LICENSE index fb09ad3..78c18d4 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index a4de2ec..039542c 100644 --- a/README.md +++ b/README.md @@ -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). @@ -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 @@ -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) ] @@ -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. diff --git a/installation/stata.toc b/installation/stata.toc index 53ace5e..1f09821 100644 --- a/installation/stata.toc +++ b/installation/stata.toc @@ -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 asjadnaqvi@gmail.com d -d Distribution-Date: 20231015 +d Distribution-Date: 20240115 d d https://medium.com/the-stata-guide d https://github.com/asjadnaqvi/Stata-schemes diff --git a/installation/streamplot.ado b/installation/streamplot.ado index 06acb7c..e181d5d 100644 --- a/installation/streamplot.ado +++ b/installation/streamplot.ado @@ -1,6 +1,7 @@ -*! streamplot v1.6 (15 Oct 2023) +*! streamplot v1.61 (15 Jan 2024) *! Asjad Naqvi (asjadnaqvi@gmail.com) +* 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. @@ -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 @@ -225,7 +226,7 @@ preserve gen _stack0 = 0 // we need this for area graphs - order date _stack0 + order `xvar' _stack0 if `rebasecat' == 0 { @@ -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 } @@ -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'")) || } diff --git a/installation/streamplot.pkg b/installation/streamplot.pkg index 0244343..79cf81b 100644 --- a/installation/streamplot.pkg +++ b/installation/streamplot.pkg @@ -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. @@ -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 diff --git a/installation/streamplot.sthlp b/installation/streamplot.sthlp index f27a7ed..ee18d50 100644 --- a/installation/streamplot.sthlp +++ b/installation/streamplot.sthlp @@ -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} @@ -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:]} @@ -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} @@ -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