diff options
author | Karl Berry <karl@freefriends.org> | 2023-01-30 20:49:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-01-30 20:49:14 +0000 |
commit | a6dc753fd014ab59a7edc661809d3230a9904cc2 (patch) | |
tree | bdd929803922a039a44897c0abe9549c1af89ea4 /Master | |
parent | 768bf114ef4191e02823fbf9139018dcecd9dffd (diff) |
tikzviolinplots (30jan23)
git-svn-id: svn://tug.org/texlive/trunk@65687 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/AFR.csv | 48 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/AMR.csv | 34 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/EMR.csv | 22 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/EUR.csv | 51 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/LICENSE | 416 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/README | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/README.md | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/SEAR.csv | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/WPR.csv | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.pdf | bin | 0 -> 352446 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.tex | 1180 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tikzviolinplots/tikzviolinplots.sty | 682 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-pictures.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/tikzviolinplots.tlpsrc | 0 |
15 files changed, 2478 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/AFR.csv b/Master/texmf-dist/doc/latex/tikzviolinplots/AFR.csv new file mode 100644 index 00000000000..a8c62270dd5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/AFR.csv @@ -0,0 +1,48 @@ +Country,Year,LifeExpectancyAtBirthMale,LifeExpectancyAtBirthFemale +Algeria,2019,76.2,78.1 +Angola,2019,60.7,65.5 +Benin,2019,61.2,65.7 +Botswana,2019,58.9,65.5 +Burkina Faso,2019,60.1,65.2 +Burundi,2019,61.5,66.1 +Cabo Verde,2019,69.9,77.9 +Cameroon,2019,60.3,64.5 +Central African Republic,2019,50.2,56.3 +Chad,2019,58,61.3 +Comoros,2019,65.9,68.9 +Congo,2019,63.8,65.6 +Côte d'Ivoire,2019,60.5,65.8 +Democratic Republic of the Congo,2019,60,64.8 +Equatorial Guinea,2019,60.9,63.6 +Eritrea,2019,61.3,67.1 +Eswatini,2019,53.4,63.2 +Ethiopia,2019,66.9,70.5 +Gabon,2019,63.6,69.7 +Gambia,2019,63.4,67.7 +Ghana,2019,63.7,69.2 +Guinea,2019,59.5,62.3 +Guinea-Bissau,2019,57.4,63 +Kenya,2019,63.7,68.4 +Lesotho,2019,47.7,54.2 +Liberia,2019,63.2,65 +Madagascar,2019,64.1,66.6 +Malawi,2019,62.3,68.9 +Mali,2019,62.2,63.4 +Mauritania,2019,68.1,68.7 +Mauritius,2019,71,77.3 +Mozambique,2019,54.5,61.7 +Namibia,2019,60.6,68.4 +Niger,2019,62.1,64.6 +Nigeria,2019,61.2,64.1 +Rwanda,2019,66.9,71.2 +Sao Tome and Principe,2019,68.8,72 +Senegal,2019,66.8,70.1 +Seychelles,2019,70,77.1 +Sierra Leone,2019,59.6,61.9 +South Africa,2019,62.2,68.3 +South Sudan,2019,60.8,64.8 +Togo,2019,61.5,67.2 +Uganda,2019,63.2,70.1 +Tanzania,2019,65.4,69.3 +Zambia,2019,59.5,65.4 +Zimbabwe,2019,57.5,63.6 diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/AMR.csv b/Master/texmf-dist/doc/latex/tikzviolinplots/AMR.csv new file mode 100644 index 00000000000..07e9541dfd8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/AMR.csv @@ -0,0 +1,34 @@ +Country,Year,LifeExpectancyAtBirthMale,LifeExpectancyAtBirthFemale +Antigua and Barbuda,2019,74.9,78 +Argentina,2019,73.5,79.5 +Bahamas,2019,69.9,76.6 +Barbados,2019,74.3,77.7 +Belize,2019,71.4,77.8 +Bolivia (Plurinational State of),2019,71.1,73.1 +Brazil,2019,72.4,79.4 +Canada,2019,80.4,84.1 +Chile,2019,78.1,83.2 +Colombia,2019,76.7,81.9 +Costa Rica,2019,78.3,83.4 +Cuba,2019,75.4,80.3 +Dominican Republic,2019,69.8,76.2 +Ecuador,2019,76.4,80.5 +El Salvador,2019,70.6,79.1 +Grenada,2019,70.6,75.3 +Guatemala,2019,69,75 +Guyana,2019,62.5,69.4 +Haiti,2019,63.3,64.8 +Honduras,2019,70.7,73.2 +Jamaica,2019,74.4,77.7 +Mexico,2019,73.1,78.9 +Nicaragua,2019,72.1,77.9 +Panama,2019,76.6,82.1 +Paraguay,2019,73.1,78.8 +Peru,2019,78.5,81.3 +Saint Lucia,2019,71.3,77.7 +Saint Vincent and the Grenadines,2019,71.3,75.3 +Suriname,2019,68.5,74.6 +Trinidad and Tobago,2019,72.5,79.9 +United States of America,2019,76.3,80.7 +Uruguay,2019,73.5,80.6 +Venezuela (Bolivarian Republic of),2019,69.9,78.2 diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/EMR.csv b/Master/texmf-dist/doc/latex/tikzviolinplots/EMR.csv new file mode 100644 index 00000000000..d08fdda5426 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/EMR.csv @@ -0,0 +1,22 @@ +Country,Year,LifeExpectancyAtBirthMale,LifeExpectancyAtBirthFemale +Afghanistan,2019,63.3,63.2 +Bahrain,2019,75,77 +Djibouti,2019,64.1,67.8 +Egypt,2019,69.6,74.1 +Iran (Islamic Republic of),2019,75.7,79.1 +Iraq,2019,69.9,75 +Jordan,2019,77,78.8 +Kuwait,2019,79.3,83.9 +Lebanon,2019,74,79.2 +Libya,2019,74.2,77.3 +Morocco,2019,71.7,74.3 +Oman,2019,73,75.3 +Pakistan,2019,64.6,66.7 +Qatar,2019,78,76.6 +Saudi Arabia,2019,73.1,76.1 +Somalia,2019,54,59.2 +Sudan,2019,67.6,70.8 +Syrian Arab Republic,2019,71.2,74.3 +Tunisia,2019,74.9,79.2 +United Arab Emirates,2019,75.1,78.4 +Yemen,2019,64.4,68.9 diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/EUR.csv b/Master/texmf-dist/doc/latex/tikzviolinplots/EUR.csv new file mode 100644 index 00000000000..1d296e41d2c --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/EUR.csv @@ -0,0 +1,51 @@ +Country,Year,LifeExpectancyAtBirthMale,LifeExpectancyAtBirthFemale +Albania,2019,76.3,79.9 +Armenia,2019,72.5,79.2 +Austria,2019,79.4,83.8 +Azerbaijan,2019,68.8,74.1 +Belarus,2019,69.7,79.6 +Belgium,2019,79.3,83.5 +Bosnia and Herzegovina,2019,74.4,79.1 +Bulgaria,2019,71.6,78.6 +Croatia,2019,75.5,81.6 +Cyprus,2019,81.1,85.1 +Czechia,2019,76.3,81.9 +Denmark,2019,79.6,83 +Estonia,2019,74.7,82.6 +Finland,2019,79.2,84 +France,2019,79.8,85.1 +Georgia,2019,68.8,77.8 +Germany,2019,78.7,84.8 +Greece,2019,78.6,83.6 +Hungary,2019,73.1,79.6 +Iceland,2019,80.8,83.9 +Ireland,2019,80.2,83.5 +Israel,2019,80.8,84.4 +Italy,2019,80.9,84.9 +Kazakhstan,2019,70,77.6 +Kyrgyzstan,2019,70.7,77.3 +Latvia,2019,70.6,79.8 +Lithuania,2019,71.2,80.4 +Luxembourg,2019,80.6,84.2 +Malta,2019,79.9,83.8 +Montenegro,2019,73.2,78.7 +Netherlands,2019,80.4,83.1 +Norway,2019,81.1,84.1 +Poland,2019,74.5,81.9 +Portugal,2019,78.6,84.4 +Republic of Moldova,2019,69.3,77.1 +North Macedonia,2019,72.8,76.9 +Romania,2019,72,79.3 +Russian Federation,2019,68.2,78 +Serbia,2019,73.5,78.3 +Slovakia,2019,74.8,81.4 +Slovenia,2019,78.6,84.1 +Spain,2019,80.7,85.7 +Sweden,2019,80.8,84 +Switzerland,2019,81.8,85.1 +Tajikistan,2019,67.6,71.5 +Turkey,2019,76.4,80.7 +Turkmenistan,2019,66.5,73 +Ukraine,2019,68,77.8 +United Kingdom of Great Britain and Northern Ireland,2019,79.8,83 +Uzbekistan,2019,70.8,75.2 diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/LICENSE b/Master/texmf-dist/doc/latex/tikzviolinplots/LICENSE new file mode 100644 index 00000000000..22443139013 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/LICENSE @@ -0,0 +1,416 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2005 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % http://www.latex-project.org/lppl.txt + % and version 1.3 or later is part of all distributions of LaTeX + % version 2005/12/01 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. + diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/README b/Master/texmf-dist/doc/latex/tikzviolinplots/README new file mode 100644 index 00000000000..b68e3f94eea --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/README @@ -0,0 +1,3 @@ +This package provides comands to draw violin plots from data, inside a +tikzpicture environment. + diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/README.md b/Master/texmf-dist/doc/latex/tikzviolinplots/README.md new file mode 100644 index 00000000000..b8717b327eb --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/README.md @@ -0,0 +1,7 @@ +tikzviolinplots +=============== + +This package is used to draw violin plots inside a `tikzpicture` environment, +using data from a file. For more information, please refer to +`tikzviolinplots.pdf`. + diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/SEAR.csv b/Master/texmf-dist/doc/latex/tikzviolinplots/SEAR.csv new file mode 100644 index 00000000000..d0a049eb38b --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/SEAR.csv @@ -0,0 +1,12 @@ +Country,Year,LifeExpectancyAtBirthMale,LifeExpectancyAtBirthFemale +Bangladesh,2019,73,75.6 +Bhutan,2019,72,74.4 +Democratic People's Republic of Korea,2019,69.3,75.7 +India,2019,69.5,72.2 +Indonesia,2019,69.4,73.3 +Maldives,2019,78.6,80.8 +Myanmar,2019,65.9,72.2 +Nepal,2019,68.9,72.7 +Sri Lanka,2019,73.8,79.8 +Thailand,2019,74.4,81 +Timor-Leste,2019,67.9,71.4 diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/WPR.csv b/Master/texmf-dist/doc/latex/tikzviolinplots/WPR.csv new file mode 100644 index 00000000000..892c9d768d5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/WPR.csv @@ -0,0 +1,21 @@ +Country,Year,LifeExpectancyAtBirthMale,LifeExpectancyAtBirthFemale +Australia,2019,81.3,84.8 +Brunei Darussalam,2019,73.4,75.4 +China,2019,74.7,80.5 +Fiji,2019,65.9,70.3 +Japan,2019,81.5,86.9 +Kiribati,2019,56.1,62.8 +Lao People's Democratic Republic,2019,66.2,70.9 +Malaysia,2019,72.6,77.1 +Micronesia (Federated States of),2019,60.3,66 +Mongolia,2019,63.8,72.8 +New Zealand,2019,80.4,83.5 +Papua New Guinea,2019,63.4,67.4 +Philippines,2019,67.4,73.6 +Republic of Korea,2019,80.3,86.1 +Samoa,2019,69.2,71.8 +Singapore,2019,81,85.5 +Solomon Islands,2019,62.9,67.9 +Tonga,2019,69.8,75.6 +Vanuatu,2019,62.7,68.3 +Viet Nam,2019,69.6,78.1 diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.pdf b/Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.pdf Binary files differnew file mode 100644 index 00000000000..3aa58bf1579 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.pdf diff --git a/Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.tex b/Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.tex new file mode 100644 index 00000000000..e53191ffe7a --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzviolinplots/tikzviolinplots.tex @@ -0,0 +1,1180 @@ +%% tikzviolinplots.tex +%% Copyright 2023 Pedro Callil-Soares +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Pedro Callil-Soares. +% +% This work consists of the files tikzviolinplots.sty and +% tikzviolinplots.tex. + +\documentclass{article} + +\usepackage{amsmath} +\usepackage{pgfplots} +\pgfplotsset{width=\textwidth,compat=1.18} +\usepgfplotslibrary{statistics} +\usepackage{tikzviolinplots} +\usepgfplotslibrary{external} +\tikzexternalize +\usetikzlibrary{arrows.meta} +\usetikzlibrary{decorations.text} +\usetikzlibrary{decorations.pathmorphing} +\usepackage{minted} +\usemintedstyle{gruvbox-light} +\usepackage{scontents} +\usepackage{wasysym} +\usepackage{microtype} +\usepackage{subcaption} +\usepackage{hyperref} + +\begin{scontents}[write-out=violinandboxplotexample.dat] +A B C D +0.876 0.574 2.175 1.684 +1.015 0.822 2.121 2.290 +0.995 1.266 1.916 2.184 +1.101 0.740 2.044 2.065 +1.222 0.636 2.004 2.248 +0.712 1.753 2.038 2.200 +1.063 0.873 1.974 1.865 +0.973 1.020 2.145 1.895 +1.174 0.763 2.052 2.240 +1.057 1.293 2.079 2.360 +1.004 0.853 2.064 1.695 +0.909 0.694 2.136 1.837 +1.108 0.849 2.000 1.744 +1.210 0.468 2.010 1.820 +0.958 0.767 1.824 2.158 +1.119 0.940 2.034 1.846 +1.000 0.962 1.967 2.545 +0.954 1.551 1.833 1.816 +0.918 0.755 1.914 2.369 +1.093 0.973 1.997 1.543 +\end{scontents} + +\begin{scontents}[write-out=example.dat] +A B C D E +0.3 -2.1 3.50 2.89 1.00 +0.41 -1.9 3.55 2.88 1.06 +0.45 -1.5 3.55 3.13 1.00 +0.46 -1.3 3.60 2.69 1.20 +0.46 -1.3 3.60 2.78 1.00 +0.46 -1.27 3.60 2.83 1.35 +0.47 -1.26 3.65 3.08 1.00 +0.47 -1.26 3.65 3.08 1.53 +0.48 -1.24 3.65 2.73 1.00 +0.51 -1.2 3.65 3.08 1.73 +0.57 -1.13 3.65 3.24 1.00 +2.3 -1.02 3.70 3.10 1.95 +2.41 -0.9 3.70 2.98 1.00 +2.46 -0.2 3.70 2.98 2.21 +2.47 0.0 3.75 3.04 1.00 +2.48 0.1 3.80 3.24 2.49 +2.51 0.3 3.85 3.16 1.00 +2.57 0.5 3.85 3.30 3.04 +\end{scontents} + +\title{The \texttt{tikzviolinplots} package} +\author{Pedro Callil-Soares} +\date{\today} + +\begin{document} + +\maketitle + +\tableofcontents + +\begin{abstract} + The package provides commands for violin plot creation and + the kernel density estimations required. +\end{abstract} + +\section{Introduction} + +This package, through the use of the package \texttt{pgfplots}, allows the +creation of violin plots in \LaTeX. Violin plots are similar to boxplots, +but instead of a box signalling the average and quartiles, a kernel density +estimator is plotted, as in equation \ref{eq:kde}, in which the function $k$ +(the kernel) is a probability distribution, the positive number $h$ (the +bandwidth) is a smoothing factor and $n$ is the sample size. + +\begin{equation} + \label{eq:kde} + \textnormal{KDE}(x) = % + \cfrac{1}{nh}\sum_{i=1}^nk\left(\cfrac{x-x_i}{h}\right) +\end{equation} + +A comparison between the two plots, showcasing its similarities, is +shown in figures \ref{fig:example}. The violin plot in figure +\ref{graph:violin_example} assumes normal data, and the bandwidth +(smoothing factor $h$ in equation \ref{eq:kde}) is defined accordingly. + +\pgfplotsset{height=1.6\linewidth} + +\begin{figure}[h!] + \centering + \begin{subfigure}{0.5\textwidth} + \centering + \begin{tikzpicture} + \begin{axis} + [ + boxplot/draw direction=y, + ymax=3, ymin=0, + xmin=0, xmax=5, + ymajorgrids=true, + xtick={1,2,3,4}, + xticklabels={$\alpha$,$\beta$,$\gamma$,$\delta$}, + ylabel={Some property}, + ] + \addplot+[boxplot, + blue!100!red, + fill=blue!100!red, + fill opacity=0.50, + no marks] + table [y=A] {violinandboxplotexample.dat}; + \addplot+[boxplot, + blue!66!red, + fill=blue!66!red, + fill opacity=0.50, + no marks] + table [y=B] {violinandboxplotexample.dat}; + \addplot+[boxplot, + blue!33!red, + fill=blue!33!red, + fill opacity=0.50, + no marks] + table [y=C] {violinandboxplotexample.dat}; + \addplot+[boxplot, + blue!0!red, + fill=blue!0!red, + fill opacity=0.50, + no marks] + table [y=D] {violinandboxplotexample.dat}; + \end{axis} + \end{tikzpicture} + \caption{Box plot} + \label{graph:box_example} + \end{subfigure}% + \hfill% + \begin{subfigure}{0.5\textwidth} + \centering + \begin{tikzpicture} + \violinsetoptions[ + averages, + data points, + scaled, + ]{ + xmin=0,xmax=5, + ymin=0,ymax=3, + xlabel style={ + yshift = {-2*height("a")} + }, + ymajorgrids=true, + ylabel={Same property}, + } + \violinplotwholefile[% + primary color=red, + secondary color=blue, + indexes={A,B,C,D}, + spacing=1.0, + labels={% + $\alpha$, + $\beta$, + $\gamma$, + $\delta$, + }, + col sep=tab, + dataset size=1pt, + dataset mark=*, + dataset fill=black!50!white, + dataset fill opacity=1.0, + average mark=x, + average size=5pt, + ]{violinandboxplotexample.dat} + \end{tikzpicture} + \caption{Violin plot} + \label{graph:violin_example} + \end{subfigure} + \caption{Box and violin plot examples} + \label{fig:example} +\end{figure} + +\pgfplotsset{height=0.9\linewidth} + +\section{Usage} + +To plot a violin plot with the commands provided, one must, inside +a \texttt{tikzpicture} environment, set the general options to all +plots and insert each individual dataset. + +To set the general options, the command \texttt{{\textbackslash}violinsetoptions} +is provided, and must be invoked before plotting the datasets. This should +be done with the commands \texttt{{\textbackslash}violinplot} or +\texttt{{\textbackslash}violinplotwholefile}. + +\subsection{General options: \texttt{{\textbackslash}violinsetoptions}} + +The command \texttt{{\textbackslash}violinsetoptions} takes two arguments, +an optional argument with package-specific options and a mandatory +argument with options to be passed to \texttt{pgfplots}. + +\begin{minted}[escapeinside=||]{latex} + \violinsetoptions[|\textit{<package-specific options>}|]% + {|\textit{<pgfplots general options>}|} +\end{minted} + +\subsubsection{Package-specific options} + +There are five options specific to the package: \texttt{scaled}, +\texttt{data points}, \texttt{averages}, \texttt{no mirror} and +\texttt{reverse axis}, controlling how and which information +in the datasets should be presented. + +The option \texttt{scaled} controls if all plots in the graph +have the same area or same width. If passed, the kernel +distribution estimations will be scaled to the same width, as +shown in figure \ref{graph:violin_verti}; otherwise, the plots +will present the same area, as in figure \ref{graph:violin_horiz}. + +The option \texttt{data points}, if passed, will show, along with +the violin plots, the distribution of points in the data set, as shown in +figure \ref{graph:violin_verti}. + +If the option \texttt{averages} is passed, the average of the data set +elements is shown, as in figure \ref{graph:violin_horiz}. + +The plots are mirrored by default; however, passing the option \texttt{no mirror} +will show only half the plot, as shown in figure \ref{graph:violin_horiz}. + +Finally, to ``transpose'' the plots (\textit{i.e.} show the distributions +as functions of the abcissa, as in figure \ref{graph:violin_horiz}, +and not as functions of ordinate, as in figure \ref{graph:violin_verti}), +one might use the option \texttt{reverse axis}. + +\subsubsection{Plot limits and other \texttt{pgfplots} options} + +The minima and maxima of the plot axes must be set in the second (and first +mandatory) argument to the command, and should follow \texttt{pgfplots} +syntax. For instance, to set the minimum and maximum of the $x$-axis +to -3 and 6, and of the $y$-axis to 2.5 and 7, one might use: + +\begin{minted}[escapeinside=||]{latex} + \violinsetoptions[|\textit{<package-specific options>}|]% + {xmin=-3, xmax=6, ymin=2.5, xmin=7,% + |\textit{<pgfplots general options>}|} +\end{minted} + +Other \texttt{pgfplots} expressions such as title or axes labels may be set +in the same way in this argument. + +\subsection{Options for each data set: \texttt{{\textbackslash}violinplot}} + +If the data sets are not very similar and/or advanced customizations +are desired, \texttt{{\textbackslash}violinplot} should be used to +plot each data set individually. +This command takes one mandatory argument, and a list of options: + +\begin{minted}[escapeinside=||]{latex} + \violinplot[% + |\textit{<option>}=\textit{<value>}| + ]{|\textit{filename}|} +\end{minted} + +The filename (mandatory argument) must be a path to a file storing the data as +space-separated columns. The optional argument is a list of options, including: + +\begin{itemize} + \item \texttt{col sep}: Column separation character in filename. + Defaults to \texttt{comma}, and can accept options + \texttt{space}, \texttt{tab}, \texttt{comma}, + \texttt{colon}, \texttt{semicolon}, \texttt{braces}, + \texttt{\&} and \texttt{ampersand}. + \item \texttt{index}: Necessary option, is the name of the column with + the data to be plotted. + \item \texttt{kernel}: The function to be used for the kernel density + estimation; available values are \texttt{gaussian} (default), + \texttt{logistic}, \texttt{parabolic}, \texttt{uniform} + and \texttt{triangular}. + \item \texttt{bandwidth}: Smoothing parameter for the kernel density + estimation; defaults to $h$ in equation \ref{eq:band}, + which assumes gaussian distribution. + \begin{equation} + \label{eq:band} + h=\sqrt[5]{\frac{4\times\textnormal{stddev}% + \left(x_1,x_2,\ldots,x_n\right)^5}{3n}} + \end{equation} + \item \texttt{samples}: Number of points in which the kernel density + estimation will be calculated and plotted. Defaults + to 50. + \item \texttt{relative position}: position of the plot in the axis + with the labels for each dataset. Defaults to 0. + \item \texttt{color}: Color of the plot, border and interior. + Defaults to black. The interior is colored with 0.5 + opacity. + \item \texttt{label}: Label of the plot, positioned at the point + set by \texttt{relative position}. + \item \texttt{invert}: If \texttt{true}, plot will be drawn in opposite + side. Useful for comparing two parts of a data set, by plotting each + group side by side. + \item Options for average and data points: + \begin{itemize} + \item \texttt{average mark}, \texttt{dataset mark}: Mark used + for averages and points of the data set (defaults + to ``\texttt{x}'' and ``\texttt{*}'', respectively). + \item \texttt{average size}, \texttt{dataset size}: Size + of each mark (defaults to 3pt for averages and 1pt + for other points). + \item \texttt{average color}, \texttt{dataset color}: Color + of each mark's border. Defaults to black in both + cases. + \item \texttt{average opacity}, \texttt{dataset opacity}: + Border opacity. Defaults to 1.0 in both cases. + \item \texttt{average fill}, \texttt{dataset fill}: Color + of each mark's interior. Defaults to black for the + points of the data set and white for the averages. + \item \texttt{average fill opacity}, \texttt{dataset fill opacity}: + Opacity of the marks. Defaults to 0.5 for averages and + 0.2 for the other points. + \end{itemize} +\end{itemize} + +\subsection{Simplified interface: \texttt{{\textbackslash}violinplotwholefile}} + +If the data sets are similar and no customizations are required, one might +use the command \texttt{{\textbackslash}violinplotwholefile}. + +\begin{minted}[escapeinside=||]{latex} + \violinplotwholefile[% + |\textit{<option>}=\textit{<value>}| + ]{|\textit{filename}|} +\end{minted} + +This command will calculate and plot all columns named. The available options +are: + +\begin{itemize} + \item \texttt{primary color}: Primary color utilised. A gradient is built from + the secondary color to it. Defaults to black. + \item \texttt{secondary color}: Secondary color utilized. A + gradient is built from it to the primary color. Defaults + to white. + \item \texttt{indexes}: List of columns to be plotted. + \item \texttt{spacing}: Distance between plots. Defaults to 1.0. + \item \texttt{labels}: Labels of the data to be plotted. +\end{itemize} + +Besides, the options available to \texttt{{\textbackslash}violinplots} are also +available for this command; for instance, one might set the kernel to +be utilized as the \texttt{uniform} kernel through the option +\texttt{kernel=uniform}. Of course, \texttt{relative position} is not an option +here. + +\section{Examples} + +To show the usage of the package, we plotted several data sets two times, in +figures \ref{graph:violin_verti} and \ref{graph:violin_horiz}, using either the +simplified or the complete interface. + +The data are in the file \texttt{example.dat}, shown below: + +\colorlet{mintedbgcsv}{black!10!white} + +\inputminted[% + frame=single, + rulecolor=mintedbgcsv, + framesep=10pt, + bgcolor=mintedbgcsv, + obeytabs, + tabsize=12, +]{text}{example.dat} + +\subsection{Simplified Interface} + +First we will plot this data using the simplified interface, resulting in +figure \ref{graph:violin_verti}. + +\begin{figure}[h] + \centering + \begin{tikzpicture} + \violinsetoptions[ + data points, + scaled, + ]{ + xmin=0,xmax=6, + ymin=-4,ymax=6, + title={Plotting Some Data}, + xlabel={Groups}, + ylabel={Some property}, + xlabel style={ + yshift = {-2*height("a")} + }, + ymajorgrids=true, + } + \violinplotwholefile[% + primary color=orange, + secondary color=black, + indexes={C,B,A,D,E}, + spacing=1.0, + labels={% + $\alpha$, + $\beta$, + $\gamma$, + $\delta$, + $\epsilon$ + }, + col sep=tab, + dataset size=2pt, + dataset mark=diamond*, + dataset fill=blue!50!white, + dataset fill opacity=1.0, + ]{example.dat} + \end{tikzpicture} + \caption{Violin plot --- vertical example} + \label{graph:violin_verti} +\end{figure} + +Code for figure \ref{graph:violin_verti}, using +\texttt{{\textbackslash}violinplotwholefile}: + +\colorlet{mintedbgverti}{orange!10!white} + +\begin{minted}[% + escapeinside=||, + frame=single, + rulecolor=mintedbgverti, + framesep=10pt, + tabsize=4, + bgcolor=mintedbgverti]{latex} +\begin{tikzpicture} + \violinsetoptions[ + data points, + scaled, + ]{ + xmin=0,xmax=6, + ymin=-4,ymax=6, + title={Plotting Some Data}, + xlabel={Groups}, + ylabel={Some property}, + xlabel style={ + yshift = {-2*height("a")} + }, + ymajorgrids=true, + } + \violinplotwholefile[% + primary color=orange, + secondary color=black, + batch indexes={C,B,A,D,E}, + batch spacing=1.0, + batch labels={% + $\alpha$, + $\beta$, + $\gamma$, + $\delta$, + $\epsilon$ + }, + col sep=tab, + dataset size=2pt, + dataset mark=diamond*, + dataset fill=blue!50!white, + dataset fill opacity=1.0, + ]{example.dat} +\end{tikzpicture} + +\end{minted} + +\subsection{Complete Interface} + +Then the data will be plotted using the complete interface, resulting +in figure \ref{graph:violin_horiz}. + +\begin{figure}[h] + \centering + \begin{tikzpicture} + \violinsetoptions[ + no mirror, + averages, + reverse axis, + ]{% + xmin=-4,xmax=6, + ymin=0.7,ymax=7, + title={Plotting Some Data}, + ylabel={Groups}, + xlabel={Some property}, + ylabel style={ + yshift = {2*width("a")} + }, + xmajorgrids=true, + } + \violinplot[% + index=C, + relative position=1, + color=blue!0!black, + label={$\alpha$}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=B, + relative position=2, + color=blue!25!black, + label={$\beta$}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=A, + relative position=3, + color=blue!50!black, + label={$\gamma$}, + col sep=tab, + kernel=parabolic, + samples=100, + bandwidth=0.4, + average mark=otimes*, + average size=2pt, + average fill=blue!70!black, + average fill opacity=0.7, + ]{example.dat} + \violinplot[% + index=D, + relative position=4, + color=blue!75!black, + label={$\delta$}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=E, + relative position=5, + color=blue!100!black, + label={$\epsilon$}, + col sep=tab, + ]{example.dat} + \end{tikzpicture} + \caption{Violin plot --- horizontal example} + \label{graph:violin_horiz} +\end{figure} + +Code for figure \ref{graph:violin_horiz}, using +\texttt{{\textbackslash}violinplot}: + +\colorlet{mintedbghoriz}{blue!10!white} + +\begin{minted}[% + escapeinside=||, + frame=single, + rulecolor=mintedbghoriz, + framesep=10pt, + tabsize=4, + bgcolor=mintedbghoriz]{latex} +\begin{tikzpicture} + \violinsetoptions[ + no mirror, + averages, + reverse axis, + ]{% + xmin=-4,xmax=6, + ymin=0.7,ymax=7, + title={Plotting Some Data}, + ylabel={Groups}, + xlabel={Some property}, + ylabel style={ + yshift = {2*width("a")} + }, + xmajorgrids=true, + } + \violinplot[% + index=C, + relative position=1, + color=blue!0!black, + label={$\alpha$}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=B, + relative position=2, + color=blue!25!black, + label={$\beta$}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=A, + relative position=3, + color=blue!50!black, + label={$\gamma$}, + col sep=tab, + kernel=parabolic, + samples=100, + bandwidth=0.4, + average mark=otimes*, + average size=2pt, + average fill=blue!70!black, + average fill opacity=0.7, + ]{example.dat}; + \violinplot[% + index=D, + relative position=4, + color=blue!75!black, + label={$\delta$}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=E, + relative position=5, + color=blue!100!black, + label={$\epsilon$}, + col sep=tab, + ]{example.dat} +\end{tikzpicture} +\end{minted} + +\subsection{Drawings and Annotations} + +As everything happens inside a \texttt{tikzpicture} environment, drawings +and annotations are straightforward, as seen in figure \ref{graph:violin_annotations}. + +\begin{figure}[h] + \centering + \begin{tikzpicture} + \violinsetoptions[ + averages, + data points, + ]{ + xmin=0,xmax=6, + ymin=-2,ymax=5, + xlabel = {Bandwidth choice}, + ylabel = {Some property}, + title={Problems with Different Distributions}, + xlabel style={ + yshift = {-3*height("a")} + }, + ymajorgrids=true, + } + \violinplot[% + index=A, + relative position=1, + color=green!33!black, + label={Estimated bandwidth}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=A, + bandwidth=0.1, + relative position=4, + color=green!12!black, + label={Smaller bandwidth}, + col sep=tab, + ]{example.dat} + \begin{axis}[ + xmin=0,xmax=6, + ymin=-2,ymax=5, + ] + \draw[-{Stealth}] (axis cs: 1.75,0.45) % + .. controls (axis cs:1.75,0.85) and % + (axis cs:3.9,0.5) .. (axis cs: 3.9,1.05); + \draw[decoration={raise=2pt,text along path, text=% + {|\tiny| Better bandwidth}, text align={center}}, % + decorate] % + (axis cs: 1.75,0.45) % + .. controls (axis cs:1.75,0.85) and % + (axis cs:3.9,0.5) .. (axis cs: 3.9,1.05); + \draw[-{Stealth}] % + (axis cs: 1.5,0.45) .. controls (axis cs:1.5,0.85) % + and (axis cs:1.25,1.1) .. (axis cs: 1.25,1.5) .. % + controls (axis cs:1.25,1.9) and (axis cs:1.35,1.9) % + .. (axis cs:1.35,2.6); + \draw[decoration={raise=2pt,text along path, text=% + {|\tiny|Very oversmoothed}, text align={center}}, % + decorate] % + (axis cs: 1.35,2.6) .. controls (axis cs:1.35,1.9) % + and (axis cs:1.25,1.9) .. (axis cs: 1.25,1.5) .. % + controls (axis cs:1.25,1.1) and (axis cs:1.5,0.85) % + .. (axis cs:1.5,0.45); + \end{axis} + \end{tikzpicture} + \caption{Annotations in a plot} + \label{graph:violin_annotations} +\end{figure} + +Figure \ref{graph:violin_annotations} is compiled from the code excerpt below. + +\colorlet{mintedbgannot}{green!10!white} + +\begin{minted}[% + escapeinside=||, + frame=single, + rulecolor=mintedbgannot, + framesep=10pt, + tabsize=4, + bgcolor=mintedbgannot]{latex} +\begin{tikzpicture} + \violinsetoptions[ + averages, + data points, + ]{ + xmin=0,xmax=6, + ymin=-2,ymax=5, + xlabel = {Bandwidth choice}, + ylabel = {Some property}, + title={Problems with Different % + Distributions}, + xlabel style={ + yshift = {-3*height("a")} + }, + ymajorgrids=true, + } + \violinplot[% + index=A, + relative position=1, + color=green!33!black, + label={Estimated bandwidth}, + col sep=tab, + ]{example.dat} + \violinplot[% + index=A, + bandwidth=0.1, + relative position=4, + color=green!12!black, + label={Smaller bandwidth}, + col sep=tab, + ]{example.dat} + \begin{axis}[ + xmin=0,xmax=6, + ymin=-2,ymax=5, + ] + \draw[-{Stealth}] (axis cs: 1.75,0.45) % + .. controls (axis cs:1.75,0.85) and % + (axis cs:3.9,0.5) .. (axis cs: 3.9,1.05); + \draw[decoration={raise=2pt,text along path,% + text={|\tiny| Better bandwidth}, % + text align={center}}, decorate] % + (axis cs: 1.75,0.45) % + .. controls (axis cs:1.75,0.85) and % + (axis cs:3.9,0.5) .. (axis cs: 3.9,1.05); + \draw[-{Stealth}] % + (axis cs: 1.5,0.45) .. controls % + (axis cs:1.5,0.85) and (axis cs:1.25,1.1) % + .. (axis cs: 1.25,1.5) .. controls % + (axis cs:1.25,1.9) and (axis cs:1.35,1.9) % + .. (axis cs:1.35,2.6); + \draw[decoration={raise=2pt,text along path, % + text={|\tiny|Very oversmoothed}, % + text align={center}}, decorate] % + (axis cs: 1.35,2.6) .. controls % + (axis cs:1.35,1.9) and (axis cs:1.25,1.9) % + .. (axis cs: 1.25,1.5) .. % + controls (axis cs:1.25,1.1) and % + (axis cs:1.5,0.85) .. (axis cs:1.5,0.45); + \end{axis} +\end{tikzpicture} +\end{minted} + +\subsection{Standalone Kernel Density Estimation} + +Plotting only one dataset and choosing adequate plot limits, one +may obtain a simple representation of a kernel density estimation. +This can be seen in figure \ref{graph:kde_standalone}, obtained from the +code excerpt below. + +\begin{figure}[h] + \centering + \begin{tikzpicture} + \violinsetoptions[ + no mirror, + reverse axis, + data points, + ]{% + xmin=3.3,xmax=4, + ymin=-1,ymax=12, + title={Plotting Some Data}, + ylabel={$p(x)$}, + xlabel={$x$}, + xmajorgrids=true, + ymajorticks=true, + ytick={0.0,2.5,5,7.5,10}, + yticklabels={0.0,2.5,5,7.5,10}, + } + \violinplot[% + index=C, + relative position=0, + color=red!30!black, + label={}, + col sep=tab, + dataset size=5pt, + dataset color=red!10!black, + dataset mark=*, + dataset fill=red!90!black, + dataset fill opacity=0.2, + ]{example.dat} + \end{tikzpicture} + \caption{Standalone kernel density estimation example} + \label{graph:kde_standalone} +\end{figure} + +\colorlet{mintedbgstand}{red!10!white} + +\begin{minted}[% + escapeinside=||, + frame=single, + rulecolor=mintedbgstand, + framesep=10pt, + tabsize=4, + bgcolor=mintedbgstand]{latex} +\begin{tikzpicture} + \violinsetoptions[ + no mirror, + reverse axis, + data points, + ]{% + xmin=3.3,xmax=4, + ymin=-1,ymax=12, + title={Plotting Some Data}, + ylabel={$p(x)$}, + xlabel={$x$}, + xmajorgrids=true, + ymajorticks=true, + ytick={0.0,2.5,5,7.5,10}, + yticklabels={0.0,2.5,5,7.5,10}, + } + \violinplot[% + index=C, + relative position=0, + color=red!30!black, + label={}, + col sep=tab, + dataset size=5pt, + dataset color=red!10!black, + dataset mark=*, + dataset fill=red!90!black, + dataset fill opacity=0.2, + ]{example.dat} +\end{tikzpicture} +\end{minted} + +\subsection{Asymmetrical Violin Plots --- Real World Data} + +Using the key \texttt{invert=true} in the options of +\texttt{\textbackslash violinplot} one can plot two different sets of data side +by side, in an asymmetrical violin plot. This can be seen in figure +\ref{graph:asymmetrical}, that exhibits the male and female life expectancy at +birth, in 2019, for several countries, segregated in the WHO regions.\footnote{ + \url{https://www.who.int/data/gho/publications/world-health-statistics}. +}. + +\colorlet{malecolor}{cyan!60!white} +\colorlet{femalecolor}{cyan!60!black} + +\begin{figure}[h] + \centering + \begin{tikzpicture} + \violinsetoptions[ + no mirror, + scaled, + ]{% + xmin=0.8,xmax=13.2, + ymin=30,ymax=100, + title={Life Expectancy Per WHO Region}, + xlabel={WHO Region}, + ylabel={Life Expectancy in Years}, + xlabel style={ + yshift = {-3*width("a")} + }, + ymajorgrids=true, + } + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=2, + color=malecolor, + label={Africa}, + col sep=comma, + invert=true + ]{AFR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=2, + color=femalecolor, + label={}, + col sep=comma, + ]{AFR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=4, + color=malecolor, + label={Middle-East}, + col sep=comma, + invert=true + ]{EMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=4, + color=femalecolor, + label={}, + col sep=comma, + ]{EMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=6, + color=malecolor, + label={Pacific}, + col sep=comma, + invert=true + ]{WPR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=6, + color=femalecolor, + label={}, + col sep=comma, + ]{WPR.csv}; + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=8, + color=malecolor, + label={SE. Asia}, + col sep=comma, + invert=true + ]{SEAR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=8, + color=femalecolor, + label={}, + col sep=comma, + ]{SEAR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=10, + color=malecolor, + label={Americas}, + col sep=comma, + invert=true + ]{AMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=10, + color=femalecolor, + label={}, + col sep=comma, + ]{AMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=12, + color=malecolor, + label={Europe}, + col sep=comma, + invert=true + ]{EUR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=12, + color=femalecolor, + label={}, + col sep=comma, + ]{EUR.csv} + \begin{axis}[ + xmin=0.8,xmax=13.2, + ymin=30,ymax=100, + ] + \draw(axis cs:2,35) node[anchor=east] {\male}; + \draw(axis cs:2,35) node[anchor=west] {\female}; + \draw(axis cs:4,35) node[anchor=east] {\male}; + \draw(axis cs:4,35) node[anchor=west] {\female}; + \draw(axis cs:6,35) node[anchor=east] {\male}; + \draw(axis cs:6,35) node[anchor=west] {\female}; + \draw(axis cs:8,35) node[anchor=east] {\male}; + \draw(axis cs:8,35) node[anchor=west] {\female}; + \draw(axis cs:10,35) node[anchor=east] {\male}; + \draw(axis cs:10,35) node[anchor=west] {\female}; + \draw(axis cs:12,35) node[anchor=east] {\male}; + \draw(axis cs:12,35) node[anchor=west] {\female}; + \end{axis} + \end{tikzpicture} + \caption{Example of asymmetrical plot} + \label{graph:asymmetrical} +\end{figure} + +The code for figure \ref{graph:asymmetrical} is avaliable below: + +\begin{minted}[% + escapeinside=||, + frame=single, + rulecolor=cyan!10!white, + framesep=10pt, + tabsize=4, + bgcolor=cyan!10!white]{latex} +\begin{tikzpicture} + \violinsetoptions[ + no mirror, + scaled, + ]{% + xmin=0,xmax=14, + ymin=30,ymax=100, + title={Life Expectancy Per WHO Region}, + xlabel={WHO Region}, + ylabel={Life Expectancy in Years}, + xlabel style={ + yshift = {-3*width("a")} + }, + ymajorgrids=true, + } + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=2, + color=malecolor, + label={AFR}, + col sep=comma, + invert=true + ]{AFR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=2, + color=femalecolor, + label={}, + col sep=comma, + ]{AFR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=4, + color=malecolor, + label={EMR}, + col sep=comma, + invert=true + ]{EMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=4, + color=femalecolor, + label={}, + col sep=comma, + ]{EMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=6, + color=malecolor, + label={WPR}, + col sep=comma, + invert=true + ]{WPR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=6, + color=femalecolor, + label={}, + col sep=comma, + ]{WPR.csv}; + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=8, + color=malecolor, + label={SEAR}, + col sep=comma, + invert=true + ]{SEAR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=8, + color=femalecolor, + label={}, + col sep=comma, + ]{SEAR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=10, + color=malecolor, + label={AMR}, + col sep=comma, + invert=true + ]{AMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=10, + color=femalecolor, + label={}, + col sep=comma, + ]{AMR.csv} + \violinplot[% + index=LifeExpectancyAtBirthMale, + relative position=12, + color=malecolor, + label={EUR}, + col sep=comma, + invert=true + ]{EUR.csv} + \violinplot[% + index=LifeExpectancyAtBirthFemale, + relative position=12, + color=femalecolor, + label={}, + col sep=comma, + ]{EUR.csv} + \begin{axis}[ + xmin=0,xmax=14, + ymin=30,ymax=100, + ] + \draw(axis cs:2,35) node[anchor=east] {\male}; + \draw(axis cs:2,35) node[anchor=west] {\female}; + \draw(axis cs:4,35) node[anchor=east] {\male}; + \draw(axis cs:4,35) node[anchor=west] {\female}; + \draw(axis cs:6,35) node[anchor=east] {\male}; + \draw(axis cs:6,35) node[anchor=west] {\female}; + \draw(axis cs:8,35) node[anchor=east] {\male}; + \draw(axis cs:8,35) node[anchor=west] {\female}; + \draw(axis cs:10,35) node[anchor=east] {\male}; + \draw(axis cs:10,35) node[anchor=west] {\female}; + \draw(axis cs:12,35) node[anchor=east] {\male}; + \draw(axis cs:12,35) node[anchor=west] {\female}; + \end{axis} +\end{tikzpicture} +\end{minted} + +\section{Limitations} + +As the math is handled through \TeX, generating the kernel distribution +estimations is a slow process; therefore, if possible, the number of samples +should not be very large. Also, each value should not, itself, be too large, +to avoid ``dimension too large'' errors. In this case, the data should be scaled +and the tick labels manually corrected. + +As each violin plot is rendered in a different \texttt{axis} environment, +the positions of the axes' labels are not, usually, correct. One should +set it manually. In the examples, this was accomplished setting the +vertical/horizontal shift to twice the height of a letter, in the direction +opposite to the appropriate axis. This approach also leads to another problem: +using the keys ``height'' or ``width'' won't rescale the plot; one might use, +before and after the code for the figure, \texttt{\textbackslash pgfplotsset}, +as shown below: + +\colorlet{mintedbgtempplotsset}{red!50!blue} +\colorlet{mintedbgplotsset}{mintedbgtempplotsset!10!white} + +\begin{minted}[% + escapeinside=||, + frame=single, + rulecolor=mintedbgplotsset, + framesep=10pt, + tabsize=4, + bgcolor=mintedbgplotsset]{latex} +\pgfplotsset{height=1.75\linewidth} +\begin{tikzpicture} + \violinsetoptions[ + |\textit{options for \texttt{tikzviolinplots}}| + ]{ + |\textit{\texttt{pgfplots} options}| + } + \violinplot[% + |\textit{options for data points}| + ]{|\textit{filename}|} + |...| +\end{tikzpicture} +\pgfplotsset{height=0.9\linewidth} +\end{minted} + +For the same reason, the options \texttt{xmin}, \texttt{ymin}, \texttt{xmax} +and \texttt{ymax} are required; no automatic placement is performed. + +\end{document} diff --git a/Master/texmf-dist/tex/latex/tikzviolinplots/tikzviolinplots.sty b/Master/texmf-dist/tex/latex/tikzviolinplots/tikzviolinplots.sty new file mode 100644 index 00000000000..33c32693b0a --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikzviolinplots/tikzviolinplots.sty @@ -0,0 +1,682 @@ +%% tikzviolinplots.sty +%% Copyright 2023 Pedro Callil-Soares +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Pedro Callil-Soares. +% +% This work consists of the files tikzviolinplots.sty and +% tikzviolinplots.tex. + +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{tikzviolinplots}[2021/08/27 v0.7.1 Violin plot creation in pgfplots] + +\RequirePackage{pgfplots} +\RequirePackage{pgfplotstable} +\RequirePackage{ifthen} +\RequirePackage{stringstrings} +\RequirePackage{pgfkeys} + + +\DeclareOption*{\PackageWarning{tikzviolinplots}{Unknown option: ‘\CurrentOption’}} +\ProcessOptions\relax + +\pgfkeys{ + /violinplot/.is family, /violinplot, + default/.style = { + col sep=comma, + kernel=gaussian, + bandwidth=NONE, + index=DATA, + samples=50, + relative position=0 + color=black, + label={LABEL}, + invert={FALSE}, + average mark=x, + average size=3pt, + average color=black, + average opacity=1.0, + average fill=white, + average fill opacity=0.5, + dataset mark=*, + dataset size=1pt, + dataset color=black, + dataset opacity=1.0, + dataset fill=black, + dataset fill opacity=0.2, + }, + col sep/.estore in = \violin@colsep, + kernel/.estore in = \violin@kernel, + bandwidth/.estore in = \violin@bandwidth, + index/.estore in = \violin@index, + samples/.estore in = \violin@samples, + relative position/.estore in = \violin@delta, + color/.estore in = \violin@color, + label/.estore in = \violin@label, + invert/.estore in = \violin@invert, + average mark/.estore in = \violin@avg@mark, + average size/.estore in = \violin@avg@size, + average color/.estore in = \violin@avg@color, + average opacity/.estore in = \violin@avg@opacity, + average fill/.estore in = \violin@avg@fillcolor, + average fill opacity/.estore in = \violin@avg@fillopacity, + dataset mark/.estore in = \violin@pts@mark, + dataset size/.estore in = \violin@pts@size, + dataset color/.estore in = \violin@pts@color, + dataset opacity/.estore in = \violin@pts@opacity, + dataset fill/.estore in = \violin@pts@fillcolor, + dataset fill opacity/.estore in = \violin@pts@fillopacity, + /violinplotwholefile/.is family, /violinplotwholefile, + default/.style = { + col sep=comma, + kernel=gaussian, + bandwidth=NONE, + index=DATA, + samples=50, + relative position=0 + color=black, + label={LABEL}, + average mark=x, + average size=3pt, + average color=black, + average opacity=1.0, + average fill=white, + average fill opacity=0.5, + dataset mark=*, + dataset size=1pt, + dataset color=black, + dataset opacity=1.0, + dataset fill=black, + dataset fill opacity=0.2, + spacing=1.0, + indexes={A,B,C}, + primary color=blue, + secondary color=black, + labels={A,B,C}, + }, + col sep/.estore in = \violin@batch@colsep, + kernel/.estore in = \violin@batch@kernel, + bandwidth/.estore in = \violin@batch@bandwidth, + index/.estore in = \violin@batch@index, + samples/.estore in = \violin@batch@samples, + relative position/.estore in = \violin@batch@delta, + color/.estore in = \violin@batch@color, + label/.estore in = \violin@batch@label, + average mark/.estore in = \violin@batch@avg@mark, + average size/.estore in = \violin@batch@avg@size, + average color/.estore in = \violin@batch@avg@color, + average opacity/.estore in = \violin@batch@avg@opacity, + average fill/.estore in = \violin@batch@avg@fillcolor, + average fill opacity/.estore in = \violin@batch@avg@fillopacity, + dataset mark/.estore in = \violin@batch@pts@mark, + dataset size/.estore in = \violin@batch@pts@size, + dataset color/.estore in = \violin@batch@pts@color, + dataset opacity/.estore in = \violin@batch@pts@opacity, + dataset fill/.estore in = \violin@batch@pts@fillcolor, + dataset fill opacity/.estore in = \violin@batch@pts@fillopacity, + spacing/.estore in = \violin@batch@delta, + indexes/.estore in = \violin@batch@indexes, + primary color/.estore in = \violin@batch@color@primary, + secondary color/.estore in = \violin@batch@color@secondary, + labels/.estore in = \violin@batch@labels, +} + +\newcommand{\violinsetoptions}[2][]{% + + \def\violin@scaled{false} + \def\violin@datapoints{false} + \def\violin@averages{false} + \def\violin@nomirror{false} + \def\violin@reverseaxis{false} + \def\violin@axisoptions{#2} + + \@for\kdeoption:=#1\do{ + \noblanks[q]{\kdeoption} + \ifthenelse{ + \equal{\thestring}{scaled} + }{ + \def\violin@scaled{true} + }{} + \ifthenelse{ + \equal{\thestring}{datapoints} + }{ + \def\violin@datapoints{true} + }{} + \ifthenelse{ + \equal{\thestring}{averages} + }{ + \def\violin@averages{true} + }{} + \ifthenelse{ + \equal{\thestring}{nomirror} + }{ + \def\violin@nomirror{true} + }{} + \ifthenelse{ + \equal{\thestring}{reverseaxis} + }{ + \def\violin@reverseaxis{true} + }{} + } + + \ifthenelse{ + \equal{\violin@reverseaxis}{true} + }{ + \begin{axis}[ + axis on top, + yticklabels={,,}, + ymajorticks=false, + \violin@axisoptions, + ] + \end{axis} + }{ + \begin{axis}[ + axis on top, + xticklabels={,,}, + xmajorticks=false, + \violin@axisoptions, + ] + \end{axis} + } + + \@for\kdeoption:=\violin@axisoptions\do{ + \noblanks[e]{\kdeoption} + \let\violin@opt\thestring + \whereisword[q]{\violin@opt}{xmin} + \ifthenelse{ + \equal{\theresult}{0} + }{}{ + \let\violin@axis@xmin\violin@opt + } + \whereisword[q]{\violin@opt}{xmax} + \ifthenelse{ + \equal{\theresult}{0} + }{}{ + \let\violin@axis@xmax\violin@opt + } + \whereisword[q]{\violin@opt}{ymin} + \ifthenelse{ + \equal{\theresult}{0} + }{}{ + \let\violin@axis@ymin\violin@opt + } + \whereisword[q]{\violin@opt}{ymax} + \ifthenelse{ + \equal{\theresult}{0} + }{}{ + \let\violin@axis@ymax\violin@opt + } + } + + \def\violin@axislimits{ + \violin@axis@xmin,\violin@axis@xmax, + \violin@axis@ymin,\violin@axis@ymax, + } + + \let\violin@axisoptions\violin@axislimits + +} + +\newcommand{\violinplot}[2][]{% + + \pgfkeys{/violinplot, default, #1} + + \def\violin@filename{#2} + + \pgfplotstableread[% + col sep=\violin@colsep, + trim cells=true, + ]{\violin@filename}\theviolin@dataset@table + + \pgfplotstablegetrowsof{\theviolin@dataset@table} + \pgfmathparse{int(\pgfmathresult-1)} + \let\violin@filename@lastindex\pgfmathresult + + \pgfmathparse{0} + \let\violin@dataset@stddev\pgfmathresult + \let\violin@dataset@average\pgfmathresult + + \pgfplotstableforeachcolumnelement{\violin@index}\of\theviolin@dataset@table\as\xi{% + \pgfmathparse{\violin@dataset@average+(\xi/(1+\violin@filename@lastindex))} + \let\violin@dataset@average\pgfmathresult + } + + \ifthenelse{ + \equal{\violin@datapoints}{true} + }{ + \pgfplotstablecreatecol[ + create col/assign/.code={ + \let\entry\violin@delta + \pgfkeyslet{/pgfplots/table/create col/next content}\entry + } + ]{deltacol}\theviolin@dataset@table + }{} + + \ifthenelse{ + \equal{\violin@reverseaxis}{true} + }{ + \def\violin@axis@x{y} + \def\violin@axis@y{x} + }{ + \def\violin@axis@x{x} + \def\violin@axis@y{y} + } + + \ifthenelse{% + \equal{\violin@bandwidth}{NONE}% + }{% + \pgfplotstableforeachcolumnelement{\violin@index}\of\theviolin@dataset@table\as\xi{% + \pgfmathparse{\violin@dataset@stddev+(\xi-\violin@dataset@average)^2} + \let\violin@dataset@stddev\pgfmathresult + } + \pgfmathparse{sqrt(\violin@dataset@stddev/(1+\violin@filename@lastindex))} + \let\violin@dataset@stddev\pgfmathresult + \pgfmathparse{1.06*\violin@dataset@stddev*((1+\violin@filename@lastindex)^(-0.2))}% + \let\violin@bandwidth\pgfmathresult + }{% + } + + \pgfplotstablegetelem{0}{\violin@index}\of{\theviolin@dataset@table} + \let\violin@dataset@min\pgfplotsretval + \let\violin@dataset@max\pgfplotsretval + \pgfplotstableforeachcolumnelement{\violin@index}\of\theviolin@dataset@table\as\xi{% + \pgfmathparse{% + \xi > \violin@dataset@min ? int(0) : int(1)% + } + \ifthenelse{ + \pgfmathresult = 1 + }{ + \let\violin@dataset@min\xi + }{ + } + } + \pgfmathparse{\violin@dataset@min - 3*\violin@bandwidth} + \let\violin@dataset@min\pgfmathresult + + \pgfplotstableforeachcolumnelement{\violin@index}\of\theviolin@dataset@table\as\xi{% + \pgfmathparse{% + \xi < \violin@dataset@max ? int(0) : int(1)% + } + \ifthenelse{ + \pgfmathresult = 1 + }{ + \let\violin@dataset@max\xi + }{ + } + } + \pgfmathparse{\violin@dataset@max + 3*\violin@bandwidth} + \let\violin@dataset@max\pgfmathresult + + \pgfplotstableset{ + create on use/list/.style={create col/expr={ + \violin@dataset@min + (\violin@dataset@max-\violin@dataset@min) + *(\pgfplotstablerow/(\violin@samples-1)) + }} + } + + + \pgfplotstablenew[columns={list}]{\violin@samples}\violin@kde + + \pgfmathparse{0.0} + \let\violin@kde@max\pgfmathresult + + \pgfplotstablecreatecol[ + create col/assign/.code={ + \pgfmathparse{\violin@filename@lastindex+1} + \let\violin@filename@lastindex\pgfmathresult + \pgfmathparse{% + 1.0/(\violin@filename@lastindex*\violin@bandwidth) + } + \let\violin@kde@factor\pgfmathresult + \pgfmathparse{0} + \let\violin@kde@accum\pgfmathresult + \pgfplotstableforeachcolumnelement{\violin@index}\of\theviolin@dataset@table\as\xi{% + \pgfmathparse{% + ((\xi-\thisrow{list})/% + \violin@bandwidth)} + \let\violin@u\pgfmathresult + \ifthenelse{ + \equal{\violin@kernel}{gaussian} + }{ + \pgfmathparse{\violin@kde@accum + % + e^(-0.5*\violin@u*\violin@u)/sqrt(2*pi)} + \let\violin@kde@accum\pgfmathresult + }{} + \ifthenelse{ + \equal{\violin@kernel}{logistic} + }{ + \pgfmathparse{\violin@kde@accum + % + 1/(e^\violin@u + 2 + e^(-\violin@u)) + } + \let\violin@kde@accum\pgfmathresult + }{} + \ifthenelse{ + \equal{\violin@kernel}{parabolic} + }{ + \pgfmathparse{% + abs(\violin@u) < 1 ? int(0) : int(1)% + } + \ifthenelse{ + \equal{\pgfmathresult}{0} + }{ + \pgfmathparse{\violin@kde@accum + % + 0.75*(1-\violin@u*\violin@u) + } + }{ + \pgfmathparse{\violin@kde@accum} + } + \let\violin@kde@accum\pgfmathresult + }{} + \ifthenelse{ + \equal{\violin@kernel}{uniform} + }{ + \pgfmathparse{% + abs(\violin@u) < 1 ? int(0) : int(1)% + } + \ifthenelse{ + \equal{\pgfmathresult}{0} + }{ + \pgfmathparse{\violin@kde@accum + 0.5} + }{ + \pgfmathparse{\violin@kde@accum} + } + \let\violin@kde@accum\pgfmathresult + }{} + \ifthenelse{ + \equal{\violin@kernel}{triangular} + }{ + \pgfmathparse{% + abs(\violin@u) < 1 ? int(0) : int(1)% + } + \ifthenelse{ + \equal{\pgfmathresult}{0} + }{ + \pgfmathparse{\violin@kde@accum + % + 1-abs(\violin@u)} + }{ + \pgfmathparse{\violin@kde@accum} + } + \let\violin@kde@accum\pgfmathresult + }{} + } + \pgfmathparse{\violin@kde@accum*\violin@kde@factor} + \let\entry\pgfmathresult + \pgfkeyslet{/pgfplots/table/create col/next content}\entry + } + ]{kdecol}\violin@kde + + \pgfplotstableforeachcolumnelement{kdecol}\of\violin@kde\as\entry{% + \pgfmathparse{% + \entry < \violin@kde@max ? int(0) : int(1)% + } + \ifthenelse{ + \pgfmathresult = 1 + }{ + \let\violin@kde@max\entry + }{ + } + } + + \pgfplotstablemodifyeachcolumnelement{kdecol}\of\violin@kde\as\cell{% + \let\pgfplotstablezero\violin@delta + \ifthenelse{ + \pgfplotstablerow = 0 + }{ + \let\cell\pgfplotstablezero + }{ + \pgfmathparse{int(\violin@samples-1)} + \ifthenelse{ + \pgfplotstablerow = \pgfmathresult + }{ + \let\cell\pgfplotstablezero + }{ + \ifthenelse{ + \equal{\violin@nomirror}{true} + }{ + \pgfmathparse{1.9} + }{ + \pgfmathparse{1} + } + \let\violin@mirror@factor\pgfmathresult + \ifthenelse{ + \equal{\violin@scaled}{true} + }{ + \pgfmathparse{\violin@delta+\violin@mirror@factor*0.5*\cell/\violin@kde@max} + }{ + \pgfmathparse{\violin@delta+\violin@mirror@factor*\cell} + } + \let\cell\pgfmathresult + } + } + } + + \ifthenelse{ + \equal{\violin@nomirror}{false} + }{ + \pgfplotstablecreatecol[ + create col/assign/.code={ + \pgfmathparse{-\thisrow{kdecol}+2*\violin@delta} + \let\entry\pgfmathresult + \pgfkeyslet{/pgfplots/table/create col/next content}\entry + } + ]{kdecolinv}\violin@kde + }{ + \ifthenelse{ + \equal{\violin@invert}{true} + }{ + \pgfplotstablemodifyeachcolumnelement{kdecol}\of\violin@kde\as\cell{% + \pgfmathparse{-\cell+2*\violin@delta} + \let\cell\pgfmathresult + } + }{} + } + + \ifthenelse{ + \equal{\violin@reverseaxis}{true} + }{ + \pgfkeys{ + /pgfplots/xticklabels={,,}, + /pgfplots/yticklabels={\violin@label}, + /pgfplots/ytick={\violin@delta}, + } + }{ + \pgfkeys{ + /pgfplots/yticklabels={,,}, + /pgfplots/xticklabels={\violin@label}, + /pgfplots/xtick={\violin@delta}, + } + } + + \begin{axis}[ + \violin@axisoptions, + axis on top, + ] + \addplot[ + no marks, + color=\violin@color, + ] table [ + \violin@axis@x=kdecol, \violin@axis@y=list + ] {\violin@kde}; + \addplot[ + no marks, + fill=\violin@color, + opacity=0.50, + ] table [ + \violin@axis@x=kdecol, \violin@axis@y=list + ] {\violin@kde}; + \ifthenelse{ + \equal{\violin@nomirror}{false} + }{ + \addplot[ + no marks, + color=\violin@color, + ] table [ + \violin@axis@x=kdecolinv, \violin@axis@y=list + ] {\violin@kde}; + \addplot[ + no marks, + fill=\violin@color, + opacity=0.50, + ] table [ + \violin@axis@x=kdecolinv, \violin@axis@y=list + ] {\violin@kde}; + }{} + \ifthenelse{ + \equal{\violin@nomirror}{true} + }{ + \ifthenelse{ + \equal{\violin@reverseaxis}{false} + }{ + \addplot[ + no marks, + color=black, + ] coordinates { + (\violin@delta,\pgfkeysvalueof{/pgfplots/ymin})% + (\violin@delta,\pgfkeysvalueof{/pgfplots/ymax}) + }; + }{ + \addplot[ + no marks, + color=black, + ] coordinates { + (\pgfkeysvalueof{/pgfplots/xmin},\violin@delta)% + (\pgfkeysvalueof{/pgfplots/xmax},\violin@delta) + }; + } + }{} + \ifthenelse{ + \equal{\violin@averages}{true} + }{ + \ifthenelse{ + \equal{\violin@reverseaxis}{true} + }{ + \addplot[ + only marks, + mark=\violin@avg@mark, + mark size=\violin@avg@size, + color=\violin@avg@color, + opacity=\violin@avg@opacity, + fill=\violin@avg@fillcolor, + fill opacity=\violin@avg@fillopacity, + ] coordinates { + (\violin@dataset@average,\violin@delta) + }; + }{ + \addplot[ + only marks, + mark=\violin@avg@mark, + mark size=\violin@avg@size, + color=\violin@avg@color, + opacity=\violin@avg@opacity, + fill=\violin@avg@fillcolor, + fill opacity=\violin@avg@fillopacity, + ] coordinates { + (\violin@delta,\violin@dataset@average) + }; + } + }{} + \ifthenelse{ + \equal{\violin@datapoints}{true} + }{ + \addplot[ + only marks, + mark=\violin@pts@mark, + mark size=\violin@pts@size, + color=\violin@pts@color, + opacity=\violin@pts@opacity, + fill=\violin@pts@fillcolor, + fill opacity=\violin@pts@fillopacity, + ] table [ + \violin@axis@x=deltacol, + \violin@axis@y=\violin@index, + ] {\theviolin@dataset@table}; + }{} + \end{axis} + +} + +\newcommand{\violin@getnth}[2]{% + \pgfmathparse{int(0)} + \let\violin@getnth@counter\pgfmathresult + \let\violin@nthelem\pgfmathresult + \@for\violin@listelem:=#1\do{ + \ifthenelse{ + \equal{#2}{\violin@getnth@counter} + }{ + \let\violin@nthelem\violin@listelem + \pgfmathparse{int(\violin@getnth@counter+1)} + \let\violin@getnth@counter\pgfmathresult + }{ + \pgfmathparse{int(\violin@getnth@counter+1)} + \let\violin@getnth@counter\pgfmathresult + } + } +} + +\newcommand{\violinplotwholefile}[2][]{% + + \pgfkeys{/violinplotwholefile, default, #1} + \def\violin@batch@filename{#2} + + \pgfmathparse{0} + \let\violin@batch@numofplots\pgfmathresult + \@for\index:=\violin@batch@indexes\do{ + \pgfmathparse{int(\violin@batch@numofplots+1)} + \let\violin@batch@numofplots\pgfmathresult + } + + \pgfmathparse{0} + \let\violin@batch@color@deg\pgfmathresult + \let\violin@batch@counter\pgfmathresult + \let\violin@batch@relativepos\pgfmathresult + + \@for\violin@batch@index:=\violin@batch@indexes\do{ + \pgfmathparse{int(\violin@batch@counter*% + (100/(\violin@batch@numofplots-1)))} + \let\violin@batch@color@deg\pgfmathresult + \edef\violin@batch@color{\violin@batch@color@primary!\violin@batch@color@deg!\violin@batch@color@secondary} + + \violin@getnth{\violin@batch@labels}{\violin@batch@counter} + \let\violin@batch@label\violin@nthelem + + \pgfmathparse{1+\violin@batch@counter*\violin@batch@delta} + \let\violin@batch@relativepos\pgfmathresult + + \violinplot[% + col sep = \violin@batch@colsep, + bandwidth=\violin@batch@bandwidth, + kernel = \violin@batch@kernel, + index=\violin@batch@index, + relative position=\violin@batch@relativepos, + samples = \violin@batch@samples, + color=\violin@batch@color, + label={\violin@batch@label}, + average mark = \violin@batch@avg@mark, + average size = \violin@batch@avg@size, + average color = \violin@batch@avg@color, + average opacity = \violin@batch@avg@opacity, + average fill = \violin@batch@avg@fillcolor, + average fill opacity = \violin@batch@avg@fillopacity, + dataset mark = \violin@batch@pts@mark, + dataset size = \violin@batch@pts@size, + dataset color = \violin@batch@pts@color, + dataset opacity = \violin@batch@pts@opacity, + dataset fill = \violin@batch@pts@fillcolor, + dataset fill opacity = \violin@batch@pts@fillopacity, + ]{\violin@batch@filename} + + \pgfmathparse{int(\violin@batch@counter+1)} + \let\violin@batch@counter\pgfmathresult + } + +} + diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 58248577c22..f33a118cbd7 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -814,7 +814,7 @@ my @TLP_working = qw( tikzmark tikzmarmots tikzorbital tikzpackets tikzpagenodes tikzpeople tikzpfeile tikzpingus tikzposter tikzscale tikzsymbols - tikztosvg tile-graphic + tikztosvg tikzviolinplots tile-graphic timbreicmc times timetable timing-diagrams tinos tipa tipa-de tipauni tipfr tiscreen titlecaps titlefoot titlepages titlepic titleref titlesec titling tkz-base tkz-berge tkz-doc tkz-euclide tkz-fct tkz-graph tkz-tab diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc index 916f1180f75..d99c524fe89 100644 --- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc @@ -212,6 +212,7 @@ depend tikzposter depend tikzscale depend tikzsymbols depend tikztosvg +depend tikzviolinplots depend tile-graphic depend timing-diagrams depend tipfr diff --git a/Master/tlpkg/tlpsrc/tikzviolinplots.tlpsrc b/Master/tlpkg/tlpsrc/tikzviolinplots.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/tikzviolinplots.tlpsrc |