Make it possible to set custom tick positions and labels with the plots.pl macro.#1389
Make it possible to set custom tick positions and labels with the plots.pl macro.#1389drgrice1 wants to merge 1 commit intoopenwebwork:PG-2.21from
plots.pl macro.#1389Conversation
d536a47 to
f0b3968
Compare
f0b3968 to
c5718f1
Compare
c5718f1 to
2246328
Compare
2246328 to
0fa3513
Compare
…ots.pl` macro. To set custom tick positions use the `tick_positions` axis option. Set that to a reference to an array containing the positions on the axis that ticks are desired. For example, `tick_positions => [ 2, 5, 9 ]` will place ticks at positions 2, 5, and 9 on the axis. Note that when this option is used the `tick_delta`, `tick_scale`, and `tick_distance` options are not used. So only the given tick positions will appear in the graph. To set custom tick labels use the `tick_labels` option. Note that this is not a new option, but now it accepts a new type of value. Previously this was purely boolean (0 or 1), and it only determined if tick labels would be shown or not. Now it can take a value that is a reference to a hash. The keys of the hash are tick positions, and the values are the labels to be placed at those positons. Note that formatting of the label must be done by the auther, and the `tick_label_format` option is ignored for any label provided in this hash. If a major tick is not listed in the hash, then the position will be used for the label and it will be formatted according to the `tick_label_format` option. This is intended to replace what is done in openwebwork#1374 and is a more flexible approach than what is done there. In that pull request the capability for custom tick labels only is added, and it is extremely restrictive in what it can do. Only positive tick labels can be customized, and it requires that the problem author label all major ticks (there is no fallback and a tick is labeled "undefined" if one is missing).
0fa3513 to
acff063
Compare
|
I will look into the |
|
Ahh, it is because |
|
This is a limitation of the |
|
Might be worth adding the |


To set custom tick positions use the
tick_positionsaxis option. Set that to a reference to an array containing the positions on the axis that ticks are desired. For example,tick_positions => [ 2, 5, 9 ]will place ticks at positions 2, 5, and 9 on the axis. Note that when this option is used thetick_delta,tick_scale, andtick_distanceoptions are not used. So only the given tick positions will appear in the graph.To set custom tick labels use the
tick_labelsoption. Note that this is not a new option, but now it accepts a new type of value. Previously this was purely boolean (0 or 1), and it only determined if tick labels would be shown or not. Now it can take a value that is a reference to a hash. The keys of the hash are tick positions, and the values are the labels to be placed at those positons. Note that formatting of the label must be done by the auther, and thetick_label_formatoption is ignored for any label provided in this hash. If a major tick is not listed in the hash, then the position will be used for the label and it will be formatted according to thetick_label_formatoption.This is intended to replace what is done in #1374 and is a more flexible approach than what is done there. In that pull request the capability for custom tick labels only is added, and it is extremely restrictive in what it can do. Only positive tick labels can be customized, and it requires that the problem author label all major ticks (there is no fallback and a tick is labeled "undefined" if one is missing).
Here is a rather rudimentary example of using this new feature: