Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive arrowheads #268

Merged
merged 6 commits into from
Mar 25, 2020
Merged

Adaptive arrowheads #268

merged 6 commits into from
Mar 25, 2020

Conversation

maxitg
Copy link
Owner

@maxitg maxitg commented Mar 15, 2020

Changes

  • Closes Adaptive arrowhead size #217.
  • Make the arrowheads adaptively change from 0.1 to 0.185 depending on the size of the graph.
  • The style spec is contributed by Jeremy Davis.

Comments

  • The arrowhead function is now in style.m. This is the first precedent where a function is used for a style.

Tests

  • Comparison of old arrowheads (on the left), and the new adaptive ones (on the right):
In[] := Grid@Transpose[
  WolframModel[{{1, 2, 3}, {4, 5, 6}, {1, 4}} -> {{2, 7, 8}, {3, 9, 
         10}, {5, 11, 12}, {6, 13, 14}, {8, 12}, {11, 10}, {13, 
         7}, {14, 9}}, {{1, 1, 1}, {1, 1, 1}, {1, 1}, {1, 1}, {1, 1}},
       3]["EventsStatesPlotsList", "ArrowheadLength" -> #] & /@ {0.1, 
    Automatic}]

image

  • The new spec makes it possible to see arrows on graphs 1.85 larger than before:
In[] := WolframModel[{{1, 2}, {2, 3}} -> {{4, 2}, {4, 1}, {2, 1}, {3, 
    4}}, {{1, 2}, {2, 3}, {3, 4}, {4, 1}}, 5, "FinalStatePlot"]

image

  • The new spec function can be looked up with WolframPhysicsProjectStyleData:
In[] := WolframPhysicsProjectStyleData["SpatialGraph", 
  "ArrowheadLengthFunction"]
Out[] = Max[0.1, Min[0.185, 0.066 + 0.017 #PlotRange]] &

This change is Reviewable

@maxitg maxitg added the feature New functionality, or change in existing functionality label Mar 15, 2020
@maxitg maxitg requested review from GetJonWithIt and sskini2 March 15, 2020 23:06
Copy link
Contributor

@GetJonWithIt GetJonWithIt left a comment

Choose a reason for hiding this comment

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

Appears to match the style spec from Jeremy, and no longer produces weird arrow sizes in corner cases. Approved to merge.

@maxitg maxitg merged commit ac56acc into master Mar 25, 2020
@maxitg maxitg deleted the adaptiveArrowheads branch March 25, 2020 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality, or change in existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adaptive arrowhead size
2 participants