Skip to content

Creation of sample problems that use the StatisticalPlots macro.#1449

Open
pstaabp wants to merge 2 commits into
openwebwork:PG-2.21from
pstaabp:add-stat-plot-sample-problems
Open

Creation of sample problems that use the StatisticalPlots macro.#1449
pstaabp wants to merge 2 commits into
openwebwork:PG-2.21from
pstaabp:add-stat-plot-sample-problems

Conversation

@pstaabp

@pstaabp pstaabp commented Jun 25, 2026

Copy link
Copy Markdown
Member

This adds some sample problems that use the StatisticalPlots.pl macro.

});

$alt_textB =
"A horizontal box plot with the box betwen $q1B and $q3B and vertical "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/betwen/between/g

I installed github.com/crate-ci/typos and it seems pretty good at catching real typos. Maybe we can integrate it into workflows. It does need manual oversight for false positives, and for when it is unsure how to correct a typo.

@drgrice1 drgrice1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
#: with the PODLINK('StatisticalPlots.pl') is available in
#: with PODLINK('StatisticalPlots.pl') is available in

Comment on lines +38 to +39
#: Use `xtick_labels` to customize the tick labels and the resulting hashref
#: is a mapping from the old tick labels to the new labels.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
#: 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.

Comment on lines +41 to +45
#: 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.
#:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
#: 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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
$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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please spell out "reference".

aria_label => 'Linear Regression'
);
$plot->add_scatterplot(
@data,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
@data,
~~@data,

Comment on lines +34 to +36
#: 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
#: 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.

Comment on lines +38 to +40
#: 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to something like

Suggested change
#: 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.

Comment on lines +74 to +78
#: 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants