Creation of sample problems that use the StatisticalPlots macro.#1449
Creation of sample problems that use the StatisticalPlots macro.#1449pstaabp wants to merge 2 commits into
Conversation
drgrice1
left a comment
There was a problem hiding this comment.
This needs some changes.
Make sure to use perltidy-pg on the added problems. All of them are showing changes when that is done.
| #:% section = preamble | ||
| #: Make sure that PODLINK('plots.pl') is loaded. | ||
| #: This produces a scatter plot with PODLINK('plots.pl'). A version of this | ||
| #: with the PODLINK('StatisticalPlots.pl') is available in |
There was a problem hiding this comment.
This should be
| #: with the PODLINK('StatisticalPlots.pl') is available in | |
| #: with PODLINK('StatisticalPlots.pl') is available in |
| #: Use `xtick_labels` to customize the tick labels and the resulting hashref | ||
| #: is a mapping from the old tick labels to the new labels. |
There was a problem hiding this comment.
This should be
| #: Use `xtick_labels` to customize the tick labels and the resulting hashref | |
| #: is a mapping from the old tick labels to the new labels. | |
| #: Use `xtick_labels` to customize the tick labels. The hash reference value | |
| #: is a mapping from tick positions to new labels. |
Please do not use hashref or arrayref anymore in documentation. They are not words.
This is not a "resulting" hash reference, it is the value set for the xtick_labels option. It does not "result" from anything. It is given.
The mapping is not from the old tick labels, but from the tick positions.
| #: The bars are added with the `add_barplot` method with the xdata and ydata. | ||
| #: The `bar_width` give a relative width of the bar. If this option is 1 | ||
| #: there is no gap between bars. | ||
| #: See PODLINK('StatisticalPlots.pl') for other options to this method. | ||
| #: |
There was a problem hiding this comment.
This should be
| #: The bars are added with the `add_barplot` method with the xdata and ydata. | |
| #: The `bar_width` give a relative width of the bar. If this option is 1 | |
| #: there is no gap between bars. | |
| #: See PODLINK('StatisticalPlots.pl') for other options to this method. | |
| #: | |
| #: The bars are added with the `add_barplot` method passing the x and y data | |
| #: values. The `bar_width` gives the relative width of the bar. If this option | |
| #: is 1, then there is no gap between bars. See PODLINK('StatisticalPlots.pl') | |
| #: for other options to this method. | |
| #: |
| $num_students = 0; | ||
| $num_students += $_ for @grades; | ||
|
|
||
| $perA = Real($grades[0] / $num_students); |
There was a problem hiding this comment.
This should be
| $perA = Real($grades[0] / $num_students); | |
| $perA = Compute($grades[0] / $num_students); |
Your question asks for a percent. If you use the Percent context, but call Real it does not create a percent. It creates a real. Using Compute in the Percent context creates a percent in the way that you describe in the documentation below.
| #: the number of minor ticks between each tick. | ||
| #: | ||
| #: The box plot is created with the `add_boxplot` method in which the data is the | ||
| #: first argument (it is an array ref, which is why the `~~` is needed). The |
| aria_label => 'Linear Regression' | ||
| ); | ||
| $plot->add_scatterplot( | ||
| @data, |
There was a problem hiding this comment.
This should be
| @data, | |
| ~~@data, |
| #: function of PODLINK('PGstatisticsmacros.pl'). Note: the x and y data | ||
| #: needs to be array references and the 2nd and 3rd lines extract the | ||
| #: components. |
There was a problem hiding this comment.
This should be
| #: function of PODLINK('PGstatisticsmacros.pl'). Note: the x and y data | |
| #: needs to be array references and the 2nd and 3rd lines extract the | |
| #: components. | |
| #: function of PODLINK('PGstatisticsmacros.pl'). Note that the x and y data values | |
| #: need to be in array references, and the 2nd and 3rd lines extract the | |
| #: components. |
| #: For the plot, first set up the `Plot` with a plotting window that will | ||
| #: capture the data. The `add_dataset` method adds the data to the plot | ||
| #: with circles and color blue. |
There was a problem hiding this comment.
Please change this to something like
| #: For the plot, first set up the `Plot` with a plotting window that will | |
| #: capture the data. The `add_dataset` method adds the data to the plot | |
| #: with circles and color blue. | |
| #: Set up the `StatPlot` with a plotting window that will | |
| #: contain the data. The `add_dataset` method adds the data to the plot | |
| #: with circle marks that are colored blue. |
| #: The data is formatted by putting the array data in a nice format using both | ||
| #: join (which joins an array separated by ', ') and map (which creates a new | ||
| #: array that formats as (x1, y1)). The [@ @] is used to run perl. | ||
| #: | ||
| #: The `[! !]{}{}` is a PGML format for inserting an image. |
There was a problem hiding this comment.
Please rework this section. It reads rather poorly. For example, the first sentence says "the data is formatted ... in a nice format". That is really bad. Also, make sure that all of the things such as ', ', (x1, y1), and [@ @] are properly set out using markdown.
I realize you copied this from the ScatterPlot.pg problem. That problem should also be fixed.
| ## DBsection(PGML tutorial 2015) | ||
| ## Date(06/01/2026) | ||
| ## Institution(Boise State University) | ||
| ## Author(Jaimos Skriletz) |
There was a problem hiding this comment.
Is "Jaimos Skriletz" really the author of this problem? I think @somiaj would make sure the problem actually worked before submitting it in a pull request.
This adds some sample problems that use the
StatisticalPlots.plmacro.