Fix drawZero for JSXGraph output of the plots macro.#1387
Open
drgrice1 wants to merge 1 commit intoopenwebwork:developfrom
Open
Fix drawZero for JSXGraph output of the plots macro.#1387drgrice1 wants to merge 1 commit intoopenwebwork:developfrom
drawZero for JSXGraph output of the plots macro.#1387drgrice1 wants to merge 1 commit intoopenwebwork:developfrom
Conversation
Currently if the y axis location is 'center', 'left' (or 'box'), or
'right', then the determination that zero is drawn is made by checking
that the y axis min or max value. That is incorrect. It should be
checking the x axis min or max value. The point is that if the y axis
is passing through x = 0, then zero should not be drawn, and otherwise
it should be.
Similarly, the y axis `drawZero` determination is fixed.
You can test this with the following problem code:
```
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'plots.pl', 'PGcourse.pl');
$graph = Plot(
xmin => -2,
xmax => 10,
xtick_distance => 1,
xminor => 0,
xlocation => 'bottom',
ymin => 0,
ymax => 10,
ytick_distance => 1,
yminor => 0,
ylocation => 'left'
);
BEGIN_PGML
[!graph!]{$graph}{500}
END_PGML
ENDDOCUMENT();
```
With that example and the develop branch the zero on the x-axis is
incorrectly not drawn in JSXGraph output. With this branch it is drawn
as it should be. Note that in TikZ output the zero is drawn with this
example. So this makes the two output formats consistent.
27e05e1 to
995ba8e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently if the y axis location is 'left' (or 'box'), or 'right', then the determination that zero is drawn is made by checking that the y axis min or max value. That is incorrect. It should be checking the x axis min or max value. The point is that if the y axis is passing through x = 0, then zero should not be drawn, and otherwise it should be.
Similarly, the y axis
drawZerodetermination is fixed.You can test this with the following problem code:
With that example and the develop branch the zero on the x-axis is incorrectly not drawn in JSXGraph output. With this branch it is drawn as it should be. Note that in TikZ output the zero is drawn with this example. So this makes the two output formats consistent.