Some improvements and additions to the SimpleGraph.pl macro.#1379
Open
drgrice1 wants to merge 3 commits intoopenwebwork:developfrom
Open
Some improvements and additions to the SimpleGraph.pl macro.#1379drgrice1 wants to merge 3 commits intoopenwebwork:developfrom
SimpleGraph.pl macro.#1379drgrice1 wants to merge 3 commits intoopenwebwork:developfrom
Conversation
This color has a contrast ratio of 6.68 against the white background. The red color has a contrast ration of 4.00 which is not sufficient for accessibility purposes.
The method returns an array containing references to arrays that form a
partition the vertex indices into the connected components of the graph.
For example, for the graph with vertices E, F, G, H, I, J, K, and L, and
edge set {{{E, L}, {F, G}, {F, L}, {G, J}, {H, I}, {J, K}, {J, L}}}, the
method will return ([E, F, G, J, K, L], [H, I]).
Instead of trying to place the labels using the coordinates, use the `anchor` and padding options to get better positioning. The primary advantage is now the labels don't float away when the image is enlarged. This was not done originally because at the time this macro was implemented the `anchor` and `padding` options didn't exist. The weights for the default layout and the wheel layout are still positioned along the perpendicular vector for now. The problem is that those labels are rotated, and that does not work well with the anchor. This is a TikZ issue (I implemented the anchor for JSXGraph to work the same as the TikZ anchor option). The problem is that the rotation is around the position of the anchor, and not around the center of the text. The usual solution for this in TikZ is to use a `\rotatebox` on the node contents. Perhaps another rotation option could be addded to the plots macro that would rotate the text instead of rotating around the anchor position.
869f31c to
2abaee7
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.
First, change the weight color used from red to FireBrick. This color has a contrast ratio of 6.68 against the white background. The red color has a contrast ration of 4.00 which is not sufficient for accessibility purposes.
Second, improve label positioning. Instead of trying to place the labels using the coordinates, use the
anchorand padding options to get better positioning. The primary advantage is now the labels don't float away when the image is enlarged. This was not done originally because at the time this macro was implemented theanchorandpaddingoptions didn't exist.The weights for the default layout and the wheel layout are still positioned along the perpendicular vector for now. The problem is that those labels are rotated, and that does not work well with the anchor. This is a TikZ issue (I implemented the anchor for JSXGraph to work the same as the TikZ anchor option). The problem is that the rotation is around the position of the anchor, and not around the center of the text. The usual solution for this in TikZ is to use a
\rotateboxon the node contents. Perhaps another rotation option could be addded to the plots macro that would rotate the text instead of rotating around the anchor position.Third, add a
componentsmethod that returns the components of the graph. The method returns an array containing references to arrays that form a partition the vertex indices into the connected components of the graph. For example, for the graph with vertices E, F, G, H, I, J, K, and L, and edge set {{{E, L}, {F, G}, {F, L}, {G, J}, {H, I}, {J, K}, {J, L}}}, the method will return ([E, F, G, J, K, L], [H, I]).