Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FancyArrowPatch heads start before the end of tails #19182

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

Closed
meakbiyik opened this issue Dec 28, 2020 · 6 comments
Closed

FancyArrowPatch heads start before the end of tails #19182

meakbiyik opened this issue Dec 28, 2020 · 6 comments
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action topic: arrow

Comments

@meakbiyik
Copy link

Bug report

Bug summary

For the exact same plot and configurations, for some values of start and end positions, FancyArrowPatch heads start before the end of their tails. An example is below to reflect what I mean by this.

I tried a lot of different parameters, yet no avail. Some stuff like increasing mutation scale indeed makes it worse though.

Code for reproduction

Data to use as "arrows" object np.array([[4.0, 2.0, 8.0, 3.731194633553613], [4.0, 8.0, 8.0, 10.0], [4.0, 14.0, 8.0, 16.0], [4.0, 20.0, 8.0, 18.0], [4.0, 26.0, 8.0, 24.0], [4.0, 32.0, 8.0, 30.0], [4.0, 38.0, 8.0, 36.0], [4.0, 44.0, 8.0, 42.0], [4.0, 56.0, 8.0, 58.0], [4.0, 62.0, 8.0, 64.0], [4.0, 68.0, 8.0, 70.0], [4.0, 74.0, 8.0, 76.0], [4.0, 80.0, 8.0, 82.0], [4.0, 86.0, 8.0, 87.4290164002233], [4.0, 92.0, 8.0, 90.0], [4.0, 50.0, 8.0, 52.0], [4.0, 98.0, 8.0, 96.0], [8.0, 5.0, 12.0, 7.0], [8.0, 11.0, 12.0, 13.0], [8.0, 17.0, 12.0, 19.0], [8.0, 23.0, 12.0, 21.0], [8.0, 29.0, 12.0, 27.0], [8.0, 35.0, 12.0, 33.0], [8.0, 41.0, 12.0, 39.0], [8.0, 47.0, 12.0, 45.0], [8.0, 53.0, 12.0, 55.0], [8.0, 59.0, 12.0, 61.0], [8.0, 65.0, 12.0, 67.0], [8.0, 71.0, 12.0, 73.0], [8.0, 77.0, 12.0, 79.0], [8.0, 83.0, 12.0, 85.0], [8.0, 89.0, 12.0, 87.0], [8.0, 95.0, 12.0, 93.0], [12.0, 2.0, 16.0, 4.0], [12.0, 8.0, 16.0, 10.0], [12.0, 14.0, 16.0, 16.0], [12.0, 20.0, 16.0, 22.0], [12.0, 26.0, 16.0, 24.0], [12.0, 32.0, 16.0, 30.0], [12.0, 38.0, 16.0, 36.0], [12.0, 44.0, 16.0, 42.0], [12.0, 50.0, 16.0, 52.0], [12.0, 56.0, 16.0, 58.0], [12.0, 62.0, 16.0, 64.0], [12.0, 68.0, 16.0, 70.0], [12.0, 74.0, 16.0, 76.0], [12.0, 80.0, 15.676285954284578, 78.0], [12.0, 86.0, 16.0, 84.0], [12.0, 92.0, 16.0, 90.0], [12.0, 98.0, 16.0, 96.0], [16.0, 5.0, 20.0, 7.0], [16.0, 11.0, 20.0, 13.0], [16.0, 17.0, 20.0, 19.0], [16.0, 23.0, 20.0, 25.0], [16.0, 29.0, 20.0, 27.0], [16.0, 35.0, 20.0, 33.0], [16.0, 41.0, 20.0, 39.0], [16.0, 47.0, 20.0, 45.0], [16.0, 53.0, 20.0, 55.0], [16.0, 59.0, 20.0, 61.0], [16.0, 65.0, 20.0, 67.0], [16.0, 71.0, 20.0, 73.0], [16.0, 77.0, 20.0, 79.0], [16.0, 83.0, 19.314066987856464, 81.0], [16.0, 89.0, 20.0, 87.0], [16.0, 95.0, 20.0, 93.0], [20.0, 2.0, 24.0, 4.0], [20.0, 8.0, 24.0, 10.0], [20.0, 14.0, 24.0, 16.0], [20.0, 20.0, 24.0, 22.0], [20.0, 26.0, 24.0, 24.0], [20.0, 32.0, 24.0, 30.0], [20.0, 38.0, 24.0, 36.0], [20.0, 44.0, 24.0, 42.0], [20.0, 50.0, 24.0, 48.0], [20.0, 56.0, 24.0, 58.0], [20.0, 62.0, 24.0, 64.0], [20.0, 68.0, 24.0, 70.0], [20.0, 74.0, 24.0, 72.0], [20.0, 80.0, 24.0, 78.0], [20.0, 86.0, 23.86327314020992, 84.0], [20.0, 92.0, 24.0, 90.0], [20.0, 98.0, 24.0, 96.0], [24.0, 5.0, 28.0, 7.0], [24.0, 11.0, 28.0, 13.0], [24.0, 17.0, 28.0, 19.0], [24.0, 23.0, 28.0, 25.0], [24.0, 29.0, 28.0, 27.0], [24.0, 35.0, 28.0, 33.0], [24.0, 41.0, 28.0, 39.0], [24.0, 47.0, 28.0, 45.0], [24.0, 53.0, 28.0, 51.0], [24.0, 59.0, 28.0, 61.0], [24.0, 65.0, 28.0, 67.0], [24.0, 71.0, 28.0, 73.0], [24.0, 77.0, 28.0, 75.0], [24.0, 83.0, 27.680358622967614, 81.0], [24.0, 89.0, 28.0, 87.0], [24.0, 95.0, 28.0, 93.0], [28.0, 2.0, 32.0, 4.0], [28.0, 8.0, 32.0, 10.0], [28.0, 14.0, 32.0, 16.0], [28.0, 20.0, 31.490768351710322, 22.0], [28.0, 26.0, 32.0, 28.0], [28.0, 32.0, 32.0, 30.0], [28.0, 38.0, 32.0, 36.0], [28.0, 44.0, 32.0, 42.0], [28.0, 50.0, 32.0, 48.0], [28.0, 56.0, 32.0, 58.0], [28.0, 62.0, 32.0, 64.0], [28.0, 68.0, 32.0, 70.0], [28.0, 74.0, 32.0, 72.0], [28.0, 80.0, 31.461999875722356, 78.0], [28.0, 86.0, 32.0, 84.0], [28.0, 92.0, 32.0, 90.0], [28.0, 98.0, 32.0, 96.0], [32.0, 5.0, 36.0, 7.0], [32.0, 11.0, 36.0, 13.0], [32.0, 17.0, 35.77161325496199, 19.0], [32.0, 23.0, 34.57696072462418, 25.0], [32.0, 29.0, 36.0, 31.0], [32.0, 35.0, 36.0, 33.0], [32.0, 41.0, 36.0, 39.0], [32.0, 47.0, 36.0, 45.0], [32.0, 53.0, 36.0, 55.0], [32.0, 59.0, 36.0, 61.0], [32.0, 65.0, 36.0, 67.0], [32.0, 71.0, 36.0, 69.0], [32.0, 77.0, 34.62637273431891, 75.0], [32.0, 83.0, 35.47892563494773, 81.0], [32.0, 89.0, 36.0, 87.0], [32.0, 95.0, 36.0, 93.0], [36.0, 2.0, 40.0, 4.0], [36.0, 8.0, 40.0, 10.0], [36.0, 14.0, 40.0, 16.0], [36.0, 20.0, 39.209951831428626, 22.0], [36.0, 26.0, 38.87715104247065, 28.0], [36.0, 32.0, 39.24516236414473, 34.0], [36.0, 38.0, 39.980025591802324, 40.0], [36.0, 44.0, 40.0, 42.0], [36.0, 50.0, 40.0, 48.0], [36.0, 56.0, 40.0, 54.0], [36.0, 62.0, 39.8562058173231, 60.0], [36.0, 68.0, 38.96714079887239, 66.0], [36.0, 74.0, 38.38977876385048, 72.0], [36.0, 80.0, 38.02129761579539, 78.0], [36.0, 86.0, 39.79845993907767, 84.0], [36.0, 92.0, 40.0, 90.0], [36.0, 98.0, 40.0, 96.0], [40.0, 5.0, 44.0, 7.0], [40.0, 11.0, 44.0, 13.0], [40.0, 17.0, 43.02213174841683, 19.0], [40.0, 23.0, 42.197311567363464, 25.0], [40.0, 29.0, 42.76637689851506, 31.0], [40.0, 35.0, 42.799210455175384, 37.0], [40.0, 41.0, 43.93919298579168, 43.0], [40.0, 47.0, 44.0, 45.0], [40.0, 53.0, 44.0, 51.0], [40.0, 59.0, 43.822336885535805, 57.0], [40.0, 65.0, 43.014934087238935, 63.0], [40.0, 71.0, 42.22225924027044, 69.0], [40.0, 77.0, 41.84939126382623, 75.0], [40.0, 83.0, 43.187327835828796, 81.0], [40.0, 89.0, 44.0, 87.0], [40.0, 95.0, 44.0, 93.0], [44.0, 2.0, 48.0, 4.0], [44.0, 8.0, 48.0, 10.0], [44.0, 14.0, 47.749584555552, 16.0], [44.0, 20.0, 46.13241495805812, 22.0], [44.0, 26.0, 46.23115681088732, 28.0], [44.0, 32.0, 46.1954003260391, 34.0], [44.0, 38.0, 46.678497146252525, 40.0], [44.0, 44.0, 47.13775363247314, 46.0], [44.0, 50.0, 47.76769408990022, 52.0], [44.0, 56.0, 47.18185397846091, 54.0], [44.0, 62.0, 46.683632854543156, 60.0], [44.0, 68.0, 45.99939548896791, 66.0], [44.0, 74.0, 45.93564344926951, 72.0], [44.0, 80.0, 45.93564344926951, 78.0], [44.0, 86.0, 47.77779057088062, 84.0], [44.0, 92.0, 48.0, 90.0], [44.0, 98.0, 48.0, 96.0], [48.0, 5.0, 52.0, 7.0], [48.0, 11.0, 51.57554549968336, 13.0], [48.0, 17.0, 50.36114193851602, 19.0], [48.0, 23.0, 49.96366763425465, 25.0], [48.0, 29.0, 50.01685172242322, 31.0], [48.0, 35.0, 49.976696810829104, 37.0], [48.0, 41.0, 50.6988846037804, 43.0], [48.0, 47.0, 50.98294299055705, 49.0], [48.0, 53.0, 51.12530398076266, 51.0], [48.0, 59.0, 50.62441655869205, 57.0], [48.0, 65.0, 50.12133809300546, 63.0], [48.0, 71.0, 49.57329806959083, 69.0], [48.0, 77.0, 49.79262616791978, 75.0], [48.0, 83.0, 50.39460028345314, 81.0], [48.0, 89.0, 52.0, 87.0], [48.0, 95.0, 52.0, 93.0], [52.0, 2.0, 56.0, 4.0], [52.0, 8.0, 55.54773785832227, 10.0], [52.0, 14.0, 54.86299561604749, 16.0], [52.0, 20.0, 53.598822922654435, 22.0], [52.0, 26.0, 53.53166214234083, 28.0], [52.0, 32.0, 53.70756275830722, 34.0], [52.0, 38.0, 54.20468068310321, 40.0], [52.0, 44.0, 54.38816605339324, 46.0], [52.0, 50.0, 54.802978729579465, 52.0], [52.0, 56.0, 54.40258162087487, 54.0], [52.0, 62.0, 53.8938274485211, 60.0], [52.0, 68.0, 53.402794610093636, 66.0], [52.0, 74.0, 53.470687748192795, 72.0], [52.0, 80.0, 53.24114037614412, 78.0], [52.0, 86.0, 54.94492564959611, 84.0], [52.0, 92.0, 56.0, 90.0], [52.0, 98.0, 56.0, 96.0], [56.0, 5.0, 59.48888581357796, 7.0], [56.0, 11.0, 58.79388274753456, 13.0], [56.0, 17.0, 57.80660936567425, 19.0], [56.0, 23.0, 57.4359700494458, 25.0], [56.0, 29.0, 57.357233186120375, 31.0], [56.0, 35.0, 57.83268444210641, 37.0], [56.0, 41.0, 58.07780451114892, 43.0], [56.0, 47.0, 58.284619407371174, 49.0], [56.0, 53.0, 58.44456885805934, 51.0], [56.0, 59.0, 57.98221530493883, 57.0], [56.0, 65.0, 57.367443146168426, 63.0], [56.0, 71.0, 57.26513066661044, 69.0], [56.0, 77.0, 57.178611486529974, 75.0], [56.0, 83.0, 57.62855244598035, 81.0], [56.0, 89.0, 59.08179894959362, 87.0], [56.0, 95.0, 60.0, 93.0], [60.0, 2.0, 63.298291673229016, 4.0], [60.0, 8.0, 62.45294843333437, 10.0], [60.0, 14.0, 61.99489767643903, 16.0], [60.0, 20.0, 61.37979774004188, 22.0], [60.0, 26.0, 61.25385797426434, 28.0], [60.0, 32.0, 61.44797360816089, 34.0], [60.0, 38.0, 61.92021078261188, 40.0], [60.0, 44.0, 61.994950109959916, 46.0], [60.0, 50.0, 62.722550875857074, 48.0], [60.0, 56.0, 61.9834376423424, 54.0], [60.0, 62.0, 61.66244375288323, 60.0], [60.0, 68.0, 61.14776450820473, 66.0], [60.0, 74.0, 61.04581273936631, 72.0], [60.0, 80.0, 61.17232166182438, 78.0], [60.0, 86.0, 61.92978276975973, 84.0], [60.0, 92.0, 62.66786421337318, 90.0], [60.0, 98.0, 63.09730687752165, 96.0], [64.0, 5.0, 66.16287808136109, 7.0], [64.0, 11.0, 65.7133126291999, 13.0], [64.0, 17.0, 65.12249322480437, 19.0], [64.0, 23.0, 65.20941441653714, 25.0], [64.0, 29.0, 65.21811456207311, 31.0], [64.0, 35.0, 65.5255665139658, 37.0], [64.0, 41.0, 65.98212850620784, 43.0], [64.0, 47.0, 66.3415384602128, 49.0], [64.0, 53.0, 66.57918471016706, 51.0], [64.0, 59.0, 65.98363854805517, 57.0], [64.0, 65.0, 65.38846458446129, 63.0], [64.0, 71.0, 64.93540044753095, 69.0], [64.0, 77.0, 65.01431157126466, 75.0], [64.0, 83.0, 65.27613472273558, 81.0], [64.0, 89.0, 65.786472205017, 87.0], [64.0, 95.0, 66.51344915514838, 93.0], [68.0, 2.0, 69.98231399223826, 4.0], [68.0, 8.0, 69.3013744455993, 10.0], [68.0, 14.0, 68.88307113639765, 16.0], [68.0, 20.0, 69.0998756533118, 22.0], [68.0, 26.0, 69.13669936284089, 28.0], [68.0, 32.0, 69.38658430738349, 34.0], [68.0, 38.0, 69.72477784213672, 40.0], [68.0, 44.0, 70.23614776054443, 46.0], [68.0, 50.0, 70.35377889435478, 48.0], [68.0, 56.0, 70.05921246731792, 54.0], [68.0, 62.0, 69.70867260030438, 60.0], [68.0, 68.0, 69.29988401849491, 66.0], [68.0, 74.0, 69.13206733069956, 72.0], [68.0, 80.0, 69.09306583752051, 78.0], [68.0, 86.0, 68.92298904428195, 84.0], [68.0, 92.0, 69.77811923843468, 90.0], [68.0, 98.0, 70.2847848654903, 96.0], [72.0, 5.0, 73.34478613484052, 7.0], [72.0, 11.0, 72.92073735466589, 13.0], [72.0, 17.0, 72.97847660974088, 19.0], [72.0, 23.0, 73.10800999528175, 25.0], [72.0, 29.0, 73.42454291749698, 31.0], [72.0, 35.0, 73.48249974562094, 37.0], [72.0, 41.0, 73.95271769870874, 43.0], [72.0, 47.0, 74.34449809302268, 49.0], [72.0, 53.0, 73.99314314426726, 51.0], [72.0, 59.0, 73.97382943589754, 57.0], [72.0, 65.0, 73.5458278697134, 63.0], [72.0, 71.0, 73.45652813742386, 69.0], [72.0, 77.0, 73.44074431417015, 75.0], [72.0, 83.0, 72.9843871100852, 81.0], [72.0, 89.0, 73.37677050603887, 87.0], [72.0, 95.0, 73.6441132906267, 93.0], [76.0, 2.0, 77.31500428901148, 4.0], [76.0, 8.0, 76.90567111304868, 10.0], [76.0, 14.0, 76.74255543144272, 16.0], [76.0, 20.0, 77.09575109879015, 22.0], [76.0, 26.0, 77.31064109366143, 28.0], [76.0, 32.0, 77.93707258887376, 34.0], [76.0, 38.0, 77.68165011163721, 40.0], [76.0, 44.0, 77.72859571945546, 46.0], [76.0, 50.0, 78.15401931590138, 48.0], [76.0, 56.0, 78.0802945426321, 54.0], [76.0, 62.0, 77.88131630776113, 60.0], [76.0, 68.0, 77.62116015618044, 66.0], [76.0, 74.0, 77.88919810644829, 72.0], [76.0, 80.0, 77.46168877639468, 78.0], [76.0, 86.0, 77.61162901475309, 84.0], [76.0, 92.0, 76.96006773855387, 90.0], [76.0, 98.0, 77.92437889220187, 96.0], [80.0, 5.0, 80.72365798008077, 7.0], [80.0, 11.0, 80.91109305595641, 13.0], [80.0, 17.0, 80.74242210920426, 19.0], [80.0, 23.0, 81.16390402632652, 25.0], [80.0, 29.0, 81.54766497040845, 31.0], [80.0, 35.0, 81.96750961137099, 37.0], [80.0, 41.0, 82.09935223154183, 43.0], [80.0, 47.0, 82.28388020015358, 45.0], [80.0, 53.0, 82.21792329496162, 51.0], [80.0, 59.0, 82.23872232468854, 57.0], [80.0, 65.0, 81.8840019837191, 63.0], [80.0, 71.0, 81.51132929960693, 69.0], [80.0, 77.0, 81.67029371102242, 75.0], [80.0, 83.0, 81.39205734547068, 81.0], [80.0, 89.0, 81.13142948891054, 87.0], [80.0, 95.0, 80.5586061376263, 93.0], [84.0, 2.0, 84.25238585781354, 4.0], [84.0, 8.0, 84.0, 10.0], [84.0, 14.0, 84.57363091780107, 16.0], [84.0, 20.0, 84.77262607820408, 22.0], [84.0, 26.0, 85.39534437712418, 28.0], [84.0, 32.0, 85.88418540867944, 34.0], [84.0, 38.0, 85.94474027594215, 40.0], [84.0, 44.0, 86.88005459092852, 46.0], [84.0, 50.0, 87.08849259722355, 48.0], [84.0, 56.0, 86.91874722412624, 54.0], [84.0, 62.0, 86.12330673029678, 60.0], [84.0, 68.0, 85.61722627522198, 66.0], [84.0, 74.0, 85.44984227464192, 72.0], [84.0, 80.0, 84.98241911363178, 78.0], [84.0, 86.0, 85.12115636126491, 84.0], [84.0, 92.0, 84.38179774507309, 90.0], [84.0, 98.0, 85.12120652012575, 96.0], [88.0, 5.0, 88.0, 7.0], [88.0, 11.0, 88.0, 13.0], [88.0, 17.0, 88.4791790405247, 19.0], [88.0, 23.0, 88.94231717403794, 25.0], [88.0, 29.0, 89.33131232716465, 31.0], [88.0, 35.0, 89.70375453149097, 37.0], [88.0, 41.0, 90.29643328515475, 43.0], [88.0, 47.0, 91.00766018903353, 49.0], [88.0, 53.0, 91.01861828455404, 51.0], [88.0, 59.0, 90.45260280872033, 57.0], [88.0, 65.0, 89.93321154471477, 63.0], [88.0, 71.0, 89.3571984866684, 69.0], [88.0, 77.0, 88.78681219354331, 75.0], [88.0, 83.0, 88.70566492926945, 81.0], [88.0, 89.0, 88.50036009132872, 87.0], [88.0, 95.0, 88.0, 93.0], [92.0, 2.0, 91.47213540335234, 4.0], [92.0, 8.0, 91.60720141943696, 10.0], [92.0, 14.0, 92.0, 16.0], [92.0, 20.0, 92.41304777790927, 22.0], [92.0, 26.0, 92.96198061646548, 28.0], [92.0, 32.0, 93.39654451822129, 34.0], [92.0, 38.0, 93.79346464594137, 40.0], [92.0, 44.0, 94.74688203011685, 46.0], [92.0, 50.0, 95.06175038320619, 52.0], [92.0, 56.0, 94.70510676583964, 54.0], [92.0, 62.0, 93.83354466408895, 60.0], [92.0, 68.0, 93.67231409884268, 66.0], [92.0, 74.0, 93.20878099853444, 72.0], [92.0, 80.0, 92.53742721702815, 78.0], [92.0, 86.0, 92.4324459655119, 84.0], [92.0, 92.0, 92.0, 90.0], [92.0, 98.0, 92.33187714326858, 96.0], [96.0, 5.0, 95.68076310208782, 7.0], [96.0, 11.0, 95.47106408577305, 13.0], [96.0, 17.0, 96.08130948554177, 19.0], [96.0, 23.0, 96.80180647705359, 25.0], [96.0, 29.0, 97.21593192499338, 31.0], [96.0, 35.0, 97.91983171682165, 37.0], [96.0, 41.0, 98.35214948213941, 43.0], [96.0, 47.0, 97.60215098368347, 49.0], [96.0, 53.0, 97.7439397983483, 51.0], [96.0, 59.0, 98.1457777108411, 57.0], [96.0, 65.0, 97.86780256042519, 63.0], [96.0, 71.0, 97.63231161471201, 69.0], [96.0, 77.0, 97.13264583237272, 75.0], [96.0, 83.0, 96.33068458772786, 81.0], [96.0, 89.0, 96.0, 87.0], [96.0, 95.0, 95.70070646887989, 93.0], [100.0, 2.0, 100.59724202940467, 4.0], [100.0, 8.0, 100.2839667320783, 10.0], [100.0, 14.0, 100.24507208318299, 16.0], [100.0, 20.0, 100.78232241341361, 22.0], [100.0, 26.0, 101.42709252336071, 28.0], [100.0, 32.0, 101.60726997724336, 34.0], [100.0, 38.0, 103.56767884005075, 36.0], [100.0, 44.0, 102.75072210105459, 46.0], [100.0, 50.0, 96.30144398975042, 52.0], [100.0, 56.0, 102.18993698881282, 54.0], [100.0, 62.0, 101.90246979370987, 60.0], [100.0, 68.0, 101.73058587982891, 66.0], [100.0, 74.0, 101.55098299602801, 72.0], [100.0, 80.0, 101.09988168131905, 78.0], [100.0, 86.0, 100.43195035255043, 84.0], [100.0, 92.0, 100.0, 90.0], [100.0, 98.0, 101.25686047278268, 96.0], [104.0, 5.0, 104.51120949306554, 7.0], [104.0, 11.0, 104.46817533101955, 13.0], [104.0, 17.0, 104.60359697074364, 19.0], [104.0, 23.0, 104.95947899181087, 25.0], [104.0, 29.0, 104.96869234770602, 31.0], [104.0, 35.0, 105.41534339924661, 37.0], [104.0, 41.0, 107.28008234885353, 39.0], [104.0, 47.0, 105.86987233527606, 49.0], [104.0, 53.0, 105.49005613172793, 51.0], [104.0, 59.0, 105.92484696111079, 57.0], [104.0, 65.0, 105.51666664173267, 63.0], [104.0, 71.0, 105.07846906406782, 69.0], [104.0, 77.0, 105.03963869557488, 75.0], [104.0, 83.0, 104.87353970099333, 81.0], [104.0, 89.0, 104.47043279268753, 87.0], [104.0, 95.0, 104.66551143264088, 93.0], [108.0, 2.0, 108.60105158086024, 4.0], [108.0, 8.0, 108.21728885907315, 10.0], [108.0, 14.0, 108.0, 16.0], [108.0, 20.0, 108.54327047282021, 22.0], [108.0, 26.0, 108.92298904428195, 28.0], [108.0, 32.0, 109.1501995378575, 34.0], [108.0, 38.0, 111.38042369218684, 36.0], [108.0, 44.0, 110.98656176206966, 42.0], [108.0, 50.0, 110.70691250958228, 52.0], [108.0, 56.0, 111.12217678547732, 58.0], [108.0, 62.0, 109.64556621398708, 60.0], [108.0, 68.0, 109.0251829384624, 66.0], [108.0, 74.0, 108.88307113639765, 72.0], [108.0, 80.0, 108.65992252151234, 78.0], [108.0, 86.0, 108.69451548539915, 84.0], [108.0, 92.0, 108.6693028064202, 90.0], [108.0, 98.0, 109.20356716276967, 96.0], [112.0, 5.0, 112.0, 7.0], [112.0, 11.0, 112.0, 13.0], [112.0, 17.0, 112.15947192373936, 19.0], [112.0, 23.0, 112.77856828979014, 25.0], [112.0, 29.0, 112.77633868715249, 31.0], [112.0, 35.0, 113.16960041767302, 37.0], [112.0, 41.0, 115.28051910177774, 39.0], [112.0, 47.0, 114.2893597167949, 49.0], [112.0, 53.0, 114.75081687539256, 55.0], [112.0, 59.0, 115.47407267307753, 61.0], [112.0, 65.0, 113.22420840753526, 63.0], [112.0, 71.0, 112.88138699988426, 69.0], [112.0, 77.0, 112.55558838240798, 75.0], [112.0, 83.0, 112.65320512436318, 81.0], [112.0, 89.0, 112.44665288787397, 87.0], [112.0, 95.0, 112.61303655344791, 93.0], [116.0, 2.0, 116.0, 4.0], [116.0, 8.0, 116.0, 10.0], [116.0, 14.0, 116.0, 16.0], [116.0, 20.0, 116.6095214899155, 22.0], [116.0, 26.0, 116.87114017662432, 28.0], [116.0, 32.0, 117.14495751564438, 34.0], [116.0, 38.0, 117.51322877169902, 40.0], [116.0, 44.0, 118.88692177367024, 42.0], [116.0, 50.0, 118.39763038176626, 52.0], [116.0, 56.0, 117.84677474732553, 54.0], [116.0, 62.0, 117.00769614763779, 60.0], [116.0, 68.0, 117.07241957944102, 66.0], [116.0, 74.0, 116.86321447625511, 72.0], [116.0, 80.0, 116.79358266409871, 78.0], [116.0, 86.0, 116.65998796275899, 84.0], [116.0, 92.0, 116.28860139939171, 90.0], [116.0, 98.0, 116.41067631263574, 96.0], [120.0, 5.0, 120.0, 7.0], [120.0, 11.0, 120.0, 13.0], [120.0, 17.0, 120.41573861537628, 19.0], [120.0, 23.0, 120.66248959001851, 25.0], [120.0, 29.0, 120.88334325812978, 31.0], [120.0, 35.0, 121.30435849043893, 37.0], [120.0, 41.0, 121.69184151866429, 43.0], [120.0, 47.0, 121.80009083783533, 49.0], [120.0, 53.0, 122.19296069461303, 51.0], [120.0, 59.0, 122.9730617201952, 61.0], [120.0, 65.0, 123.02764002686968, 67.0], [120.0, 71.0, 120.9645777925275, 69.0], [120.0, 77.0, 121.02684583357288, 75.0], [120.0, 83.0, 120.43549191828163, 81.0], [120.0, 89.0, 120.17924988332909, 87.0], [120.0, 95.0, 120.0, 93.0], [124.0, 2.0, 124.0, 4.0], [124.0, 8.0, 124.0, 10.0], [124.0, 14.0, 124.0, 16.0], [124.0, 20.0, 124.78190665488206, 22.0], [124.0, 26.0, 124.9328676344863, 28.0], [124.0, 32.0, 125.35902593369725, 34.0], [124.0, 38.0, 125.64105587104902, 40.0], [124.0, 44.0, 125.88462988024261, 46.0], [124.0, 50.0, 126.27840695890204, 52.0], [124.0, 56.0, 125.90856481069709, 54.0], [124.0, 62.0, 126.69067024766049, 64.0], [124.0, 68.0, 125.19018184586125, 66.0], [124.0, 74.0, 124.96333049350739, 72.0], [124.0, 80.0, 124.69606525291152, 78.0], [124.0, 86.0, 124.38503337587966, 84.0], [124.0, 92.0, 124.0, 90.0], [124.0, 98.0, 124.0, 96.0], [128.0, 5.0, 128.0, 7.0], [128.0, 11.0, 128.0, 13.0], [128.0, 17.0, 128.55502472665657, 19.0], [128.0, 23.0, 128.8017588126946, 25.0], [128.0, 29.0, 129.1011293882821, 31.0], [128.0, 35.0, 129.38118239082286, 37.0], [128.0, 41.0, 130.27382088862984, 39.0], [128.0, 47.0, 129.9483029839667, 49.0], [128.0, 53.0, 129.59650689520535, 51.0], [128.0, 59.0, 130.53181898046034, 61.0], [128.0, 65.0, 130.57243572118279, 67.0], [128.0, 71.0, 129.11565289452926, 69.0], [128.0, 77.0, 128.85747311746715, 75.0], [128.0, 83.0, 128.35875998824238, 81.0], [128.0, 89.0, 128.0, 87.0], [128.0, 95.0, 128.0, 93.0], [132.0, 2.0, 131.9108478420704, 4.0], [132.0, 8.0, 132.0, 10.0], [132.0, 14.0, 132.0, 16.0], [132.0, 20.0, 132.80173413951806, 22.0], [132.0, 26.0, 132.91583198142044, 28.0], [132.0, 32.0, 133.17031059823964, 34.0], [132.0, 38.0, 133.26582562019854, 40.0], [132.0, 44.0, 133.9345082991231, 42.0], [132.0, 50.0, 133.77369737855534, 52.0], [132.0, 56.0, 133.4671330725512, 54.0], [132.0, 62.0, 134.3197349257771, 64.0], [132.0, 68.0, 133.0407232144942, 66.0], [132.0, 74.0, 132.9061443541742, 72.0], [132.0, 80.0, 132.38199910712487, 78.0], [132.0, 86.0, 132.25021626865225, 84.0], [132.0, 92.0, 132.0, 90.0], [132.0, 98.0, 132.0, 96.0], [136.0, 5.0, 135.73975951706763, 7.0], [136.0, 11.0, 136.0, 13.0], [136.0, 17.0, 136.4329125879478, 19.0], [136.0, 23.0, 136.8165304826365, 25.0], [136.0, 29.0, 136.963100017566, 31.0], [136.0, 35.0, 137.01890581571666, 37.0], [136.0, 41.0, 137.1812614759553, 43.0], [136.0, 47.0, 137.5015217092832, 49.0], [136.0, 53.0, 137.45253788948983, 51.0], [136.0, 59.0, 138.07319068519885, 61.0], [136.0, 65.0, 138.41751678197113, 67.0], [136.0, 71.0, 136.91583198142044, 69.0], [136.0, 77.0, 136.77760234008005, 75.0], [136.0, 83.0, 136.44433109504183, 81.0], [136.0, 89.0, 136.0, 87.0], [136.0, 95.0, 136.0, 93.0], [140.0, 2.0, 139.6576739463181, 4.0], [140.0, 8.0, 139.59290390679163, 10.0], [140.0, 14.0, 140.2211488770299, 16.0], [140.0, 20.0, 140.80435949595005, 22.0], [140.0, 26.0, 140.7521259455021, 28.0], [140.0, 32.0, 140.8760126053381, 34.0], [140.0, 38.0, 141.11361381012145, 40.0], [140.0, 44.0, 141.99315214711277, 42.0], [140.0, 50.0, 141.5840701841805, 52.0], [140.0, 56.0, 142.07764631891496, 58.0], [140.0, 62.0, 142.14457817724636, 64.0], [140.0, 68.0, 140.7640184146544, 66.0], [140.0, 74.0, 140.79008156282515, 72.0], [140.0, 80.0, 140.66117036548982, 78.0], [140.0, 86.0, 140.0, 84.0], [140.0, 92.0, 140.0, 90.0], [140.0, 98.0, 140.0, 96.0], [144.0, 5.0, 143.4187064085591, 7.0], [144.0, 11.0, 144.0, 13.0], [144.0, 17.0, 144.20326979120517, 19.0], [144.0, 23.0, 144.80556201199386, 25.0], [144.0, 29.0, 144.92007936655838, 31.0], [144.0, 35.0, 144.69421383665184, 37.0], [144.0, 41.0, 144.8840388646206, 43.0], [144.0, 47.0, 145.01795218011844, 49.0], [144.0, 53.0, 145.79318812338877, 55.0], [144.0, 59.0, 146.4520873789737, 61.0], [144.0, 65.0, 144.81996375617183, 63.0], [144.0, 71.0, 144.79492986834714, 69.0], [144.0, 77.0, 144.69365905921657, 75.0], [144.0, 83.0, 144.45164617541246, 81.0], [144.0, 89.0, 143.86585006555825, 87.0], [144.0, 95.0, 143.44915675697644, 93.0], [148.0, 2.0, 147.42247604785013, 4.0], [148.0, 8.0, 147.55566890495817, 10.0], [148.0, 14.0, 148.0, 16.0], [148.0, 20.0, 148.77271244271938, 22.0], [148.0, 26.0, 148.88403492294964, 28.0], [148.0, 32.0, 148.7279086990418, 34.0], [148.0, 38.0, 148.70420525419155, 40.0], [148.0, 44.0, 148.98258915644908, 46.0], [148.0, 50.0, 149.81000841912706, 48.0], [148.0, 56.0, 150.58789157257092, 58.0], [148.0, 62.0, 150.33765107319306, 64.0], [148.0, 68.0, 149.04570824519845, 66.0], [148.0, 74.0, 148.98112238020155, 72.0], [148.0, 80.0, 148.56494739431807, 78.0], [148.0, 86.0, 148.0, 84.0], [148.0, 92.0, 147.2535003057988, 90.0], [148.0, 98.0, 147.75774061795232, 96.0], [152.0, 5.0, 151.52011150477293, 7.0], [152.0, 11.0, 152.0, 13.0], [152.0, 17.0, 152.816963987749, 19.0], [152.0, 23.0, 152.87913597705617, 25.0], [152.0, 29.0, 153.15246763919367, 31.0], [152.0, 35.0, 152.65652203045335, 37.0], [152.0, 41.0, 152.80131869993124, 43.0], [152.0, 47.0, 153.47668980241667, 49.0], [152.0, 53.0, 153.86621415829694, 55.0], [152.0, 59.0, 154.91212861196294, 61.0], [152.0, 65.0, 155.3520719425066, 67.0], [152.0, 71.0, 153.52831686394984, 69.0], [152.0, 77.0, 153.19028325804123, 75.0], [152.0, 83.0, 152.60699060364394, 81.0], [152.0, 89.0, 152.0, 87.0], [152.0, 95.0, 151.36293992777883, 93.0], [156.0, 2.0, 155.024813541626, 4.0], [156.0, 8.0, 156.0, 10.0], [156.0, 14.0, 157.06847736155194, 16.0], [156.0, 20.0, 156.5523873581574, 22.0], [156.0, 26.0, 157.42417703686192, 28.0], [156.0, 32.0, 157.00248884653115, 34.0], [156.0, 38.0, 157.16657351423916, 40.0], [156.0, 44.0, 156.9368527623082, 46.0], [156.0, 50.0, 157.8100772936504, 52.0], [156.0, 56.0, 157.5202249070506, 54.0], [156.0, 62.0, 159.55837696849392, 64.0], [156.0, 68.0, 159.4850767766335, 70.0], [156.0, 74.0, 157.67247863745368, 72.0], [156.0, 80.0, 157.14155464130138, 78.0], [156.0, 86.0, 156.70200968003329, 84.0], [156.0, 92.0, 155.30155274462993, 90.0], [156.0, 98.0, 155.47214500407665, 96.0], [160.0, 5.0, 160.0, 7.0], [160.0, 11.0, 161.02036003284906, 13.0], [160.0, 17.0, 161.0001557713745, 19.0], [160.0, 23.0, 160.9244388200431, 25.0], [160.0, 29.0, 161.1748653862938, 31.0], [160.0, 35.0, 160.0, 37.0], [160.0, 41.0, 160.51399707791867, 43.0], [160.0, 47.0, 161.69645641562784, 49.0], [160.0, 53.0, 160.9804886180167, 55.0], [160.0, 59.0, 161.03722455306047, 57.0], [160.0, 65.0, 163.75659420219964, 67.0], [160.0, 71.0, 161.64888244434397, 69.0], [160.0, 77.0, 161.51260821586234, 75.0], [160.0, 83.0, 161.10601620961165, 81.0], [160.0, 89.0, 160.40409358038914, 87.0], [160.0, 95.0, 159.4752964401895, 93.0], [164.0, 2.0, 163.80628558519663, 4.0], [164.0, 8.0, 164.34992795115062, 10.0], [164.0, 14.0, 165.2892838942333, 16.0], [164.0, 20.0, 164.84421683767283, 22.0], [164.0, 26.0, 165.06451580455254, 28.0], [164.0, 32.0, 164.39744982435204, 34.0], [164.0, 38.0, 164.0, 40.0], [164.0, 44.0, 164.0, 46.0], [164.0, 50.0, 165.4573126291999, 52.0], [164.0, 56.0, 164.91058600930086, 54.0], [164.0, 62.0, 164.63587927286224, 60.0], [164.0, 68.0, 165.2336033932523, 66.0], [164.0, 74.0, 165.63948157342693, 72.0], [164.0, 80.0, 165.46933344527514, 78.0], [164.0, 86.0, 165.11482212645976, 84.0], [164.0, 92.0, 163.84552650101176, 90.0], [164.0, 98.0, 163.5682196767942, 96.0], [168.0, 5.0, 168.12319732753954, 7.0], [168.0, 11.0, 168.9990906235393, 13.0], [168.0, 17.0, 169.15333505710066, 19.0], [168.0, 23.0, 168.71293540496242, 25.0], [168.0, 29.0, 168.0, 31.0], [168.0, 35.0, 167.5935169453769, 37.0], [168.0, 41.0, 168.0, 43.0], [168.0, 47.0, 168.90964062889253, 49.0], [168.0, 53.0, 168.4349039233223, 55.0], [168.0, 59.0, 168.78806945464632, 57.0], [168.0, 65.0, 168.48470474392568, 63.0], [168.0, 71.0, 168.97499646244788, 69.0], [168.0, 77.0, 169.2277405804146, 75.0], [168.0, 83.0, 168.87440831584126, 81.0], [168.0, 89.0, 168.56276981266993, 87.0], [168.0, 95.0, 168.0, 93.0], [172.0, 2.0, 171.2620080378115, 4.0], [172.0, 8.0, 172.3954025251832, 10.0], [172.0, 14.0, 172.65299020882225, 16.0], [172.0, 20.0, 172.65375646990717, 22.0], [172.0, 26.0, 172.3199034501836, 28.0], [172.0, 32.0, 172.0, 34.0], [172.0, 38.0, 172.0, 40.0], [172.0, 44.0, 172.0, 46.0], [172.0, 50.0, 172.0, 52.0], [172.0, 56.0, 172.0, 54.0], [172.0, 62.0, 172.1446535378453, 60.0], [172.0, 68.0, 172.39852798148254, 66.0], [172.0, 74.0, 172.35722689163885, 72.0], [172.0, 80.0, 172.62080833845332, 78.0], [172.0, 86.0, 172.41715000553168, 84.0], [172.0, 92.0, 172.0, 90.0], [172.0, 98.0, 171.34450275718032, 96.0], [176.0, 5.0, 176.0, 7.0], [176.0, 11.0, 176.30918953606698, 13.0], [176.0, 17.0, 176.3554227353074, 19.0], [176.0, 23.0, 176.2452526440528, 25.0], [176.0, 29.0, 176.0, 31.0], [176.0, 35.0, 175.4000115389231, 37.0], [176.0, 41.0, 176.0, 43.0], [176.0, 47.0, 176.0, 49.0], [176.0, 53.0, 176.0, 51.0], [176.0, 59.0, 176.0, 57.0], [176.0, 65.0, 176.0, 63.0], [176.0, 71.0, 176.0, 69.0], [176.0, 77.0, 176.30226137056914, 75.0], [176.0, 83.0, 176.0, 81.0], [176.0, 89.0, 176.0, 87.0], [176.0, 95.0, 175.57411741557368, 93.0], [180.0, 2.0, 179.1091282589416, 4.0], [180.0, 8.0, 180.0, 10.0], [180.0, 14.0, 180.0, 16.0], [180.0, 20.0, 180.0, 22.0], [180.0, 26.0, 179.80032231938932, 28.0], [180.0, 32.0, 179.49802200936384, 34.0], [180.0, 38.0, 179.49059911373067, 40.0], [180.0, 44.0, 180.0, 46.0], [180.0, 50.0, 179.71600633211006, 52.0], [180.0, 56.0, 180.0, 54.0], [180.0, 62.0, 180.0, 60.0], [180.0, 68.0, 179.68225936895763, 66.0], [180.0, 74.0, 179.3800633568909, 72.0], [180.0, 80.0, 179.53851850081867, 78.0], [180.0, 86.0, 179.69893616477017, 84.0], [180.0, 92.0, 179.43829012603084, 90.0], [180.0, 98.0, 178.89879901747085, 96.0], [184.0, 5.0, 183.04886396265746, 7.0], [184.0, 11.0, 183.62821165977132, 13.0], [184.0, 17.0, 183.58938321479403, 19.0], [184.0, 23.0, 183.48480265631844, 25.0], [184.0, 29.0, 183.50324627200533, 31.0], [184.0, 35.0, 183.33690166826537, 37.0], [184.0, 41.0, 183.60154322504803, 43.0], [184.0, 47.0, 184.0, 49.0], [184.0, 53.0, 183.35356014729692, 51.0], [184.0, 59.0, 183.66262978711535, 57.0], [184.0, 65.0, 183.50060466348828, 63.0], [184.0, 71.0, 182.8704605659434, 69.0], [184.0, 77.0, 182.9704455682234, 75.0], [184.0, 83.0, 183.3400988760109, 81.0], [184.0, 89.0, 183.0929339955081, 87.0], [184.0, 95.0, 182.60140957221716, 93.0], [188.0, 2.0, 186.47685386680786, 4.0], [188.0, 8.0, 187.15618811647263, 10.0], [188.0, 14.0, 187.1886545956377, 16.0], [188.0, 20.0, 187.20040975172205, 22.0], [188.0, 26.0, 187.0960412343798, 28.0], [188.0, 32.0, 187.1630532185623, 34.0], [188.0, 38.0, 187.34172712087755, 40.0], [188.0, 44.0, 188.0, 46.0], [188.0, 50.0, 187.53603588202162, 48.0], [188.0, 56.0, 187.3256117558755, 54.0], [188.0, 62.0, 187.09130953583693, 60.0], [188.0, 68.0, 186.68965901003037, 66.0], [188.0, 74.0, 186.25850775422984, 72.0], [188.0, 80.0, 186.44205809162557, 78.0], [188.0, 86.0, 186.74477308556118, 84.0], [188.0, 92.0, 186.47868383037638, 90.0], [188.0, 98.0, 185.59707790394975, 96.0], [192.0, 5.0, 190.43776222902363, 7.0], [192.0, 11.0, 190.80928718761538, 13.0], [192.0, 17.0, 190.90624708279609, 19.0], [192.0, 23.0, 190.63054960350095, 25.0], [192.0, 29.0, 190.83856263853178, 31.0], [192.0, 35.0, 190.8788585206692, 37.0], [192.0, 41.0, 190.90154387294712, 43.0], [192.0, 47.0, 191.25132262812906, 49.0], [192.0, 53.0, 190.93211714166458, 51.0], [192.0, 59.0, 190.79168001676675, 57.0], [192.0, 65.0, 190.32716425081406, 63.0], [192.0, 71.0, 189.68754031760426, 69.0], [192.0, 77.0, 189.87336164332518, 75.0], [192.0, 83.0, 190.09541403190087, 81.0], [192.0, 89.0, 190.36533932831236, 87.0], [192.0, 95.0, 189.84211029562098, 93.0], [196.0, 2.0, 193.20853758060252, 4.0], [196.0, 8.0, 194.22826332517, 10.0], [196.0, 14.0, 194.41165566918755, 16.0], [196.0, 20.0, 194.35738525411637, 22.0], [196.0, 26.0, 194.2415646901948, 28.0], [196.0, 32.0, 194.28390663767928, 34.0], [196.0, 38.0, 194.4979950019102, 40.0], [196.0, 44.0, 193.01435429889955, 46.0], [196.0, 50.0, 193.66543681159618, 48.0], [196.0, 56.0, 193.13505322226845, 54.0], [196.0, 62.0, 193.1079186824539, 60.0], [196.0, 68.0, 193.28971652209523, 66.0], [196.0, 74.0, 193.32014098455846, 72.0], [196.0, 80.0, 193.56615824590043, 78.0], [196.0, 86.0, 193.96989362193813, 84.0], [196.0, 92.0, 193.75834591258706, 90.0], [196.0, 98.0, 193.25365867886677, 96.0], [200.0, 5.0, 197.89472035086118, 7.0], [200.0, 11.0, 198.0306873708001, 13.0], [200.0, 17.0, 197.9238089963813, 19.0], [200.0, 23.0, 198.3081584813357, 25.0], [200.0, 29.0, 197.85270959157035, 31.0], [200.0, 35.0, 198.00170010852565, 37.0], [200.0, 41.0, 197.7476008394898, 43.0], [200.0, 47.0, 197.92542213401373, 45.0], [200.0, 59.0, 198.41058238579595, 57.0], [200.0, 65.0, 196.63959925868383, 63.0], [200.0, 71.0, 196.96337270034132, 69.0], [200.0, 77.0, 197.53546505579055, 75.0], [200.0, 83.0, 197.2390470239672, 81.0], [200.0, 89.0, 197.47510936410467, 87.0], [200.0, 95.0, 197.02427562508882, 93.0]])
from matplotlib.collections import PatchCollection
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.patches import FancyArrowPatch

plt.figure(figsize=(40,20))
ax = plt.gca()

arrow_patches=[]
for x1, y1, x2, y2 in arrows:
    arrow_patches.append(
        FancyArrowPatch(
            (x1, y1),
            (x2, y2),
            linewidth=3,
            color="red",
            shrinkA=0,
            shrinkB=0,
            arrowstyle="-|>, head_length=0.3, head_width=0.3"
        )
    )
arrow_collection = PatchCollection(arrow_patches, zorder=1, match_original=True)
ax.set_xlim(0,202)
ax.set_ylim(0,101)
ax.add_collection(arrow_collection)

Actual outcome

image

Observe the peculiarity in the paths of some arrows, as their heads immediately start with the tail.

Expected outcome

Some fancy arrows?

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.3.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.8.6
  • Jupyter version (if applicable): (ipykernel version) 5.3.4

Installed with pip (via Poetry)

@dstansby
Copy link
Member

Thanks for the detailed bug report! Could you narrow down some example values of x1, x2, y1, y2 where the arrow is drawn incorrectly?

@meakbiyik
Copy link
Author

meakbiyik commented Dec 28, 2020

When I looked at this a bit more deeply, I realized that the arrows are drawn completely wrong. The starting points are correct, but the ends points are all messed up. I thought this had something to do with "shrink" arguments, yet they are all zero and I do not completely understand why do they in any way affect the coordinate-wise positions of the arrows. If this is expected behavior, I would like to know the correct way to handle things so that it behaves as any other matplotlib artist behaves.

from matplotlib.collections import PatchCollection
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.patches import FancyArrowPatch

plt.figure(figsize=(40,20))
ax = plt.gca()

arrows = np.array([
    [48.0, 71.0, 49.57329806959083, 69.0], 
    [48.0, 77.0, 49.79262616791978, 75.0], 
    [48.0, 83.0, 50.39460028345314, 81.0], 
    [48.0, 89.0, 52.0, 87.0], 
    [48.0, 95.0, 52.0, 93.0]
])

arrow_patches=[]
for x1, y1, x2, y2 in arrows:
    arrow_patches.append(
        FancyArrowPatch(
            (x1, y1),
            (x2, y2),
            linewidth=3,
            color="red",
            shrinkA=0,
            shrinkB=0,
            arrowstyle="-|>, head_length=0.3, head_width=0.3"
        )
    )
arrow_collection = PatchCollection(arrow_patches, zorder=1, match_original=True)
ax.set_xlim(47,51)
ax.set_ylim(70,96)
ax.add_collection(arrow_collection)

image

@meakbiyik
Copy link
Author

meakbiyik commented Dec 28, 2020

Okay, found it I think. It is the linewidth argument that messes things up here. I really did not suspect that, it is weird. Is this expected? Should we not touch lw while playing with arrows? Then how will we determine the width for fancyarrowpatch?

FancyArrowPatch(
    (x1, y1),
    (x2, y2),
    color="red",
    shrinkA=0,
    shrinkB=0,
    arrowstyle="-|>, head_length=0.3, head_width=0.3"
)

image

EDIT: As a final addition, removing both the linewidth and shrink arguments (i.e. defaulting them) also produces this error.

FancyArrowPatch(
    (x1, y1),
    (x2, y2),
    color="red",
    arrowstyle="-|>, head_length=0.3, head_width=0.3"
)

image

@meakbiyik
Copy link
Author

meakbiyik commented Jan 11, 2021

Found the culprit. In this line, a padding is calculated for the projected edge, that basically forces the arrow wedge to be placed in somewhere it should not be. For shrinkA=0 and shrinkB=0, there shouldn't even be such a parameter (though I do not understand why there are shrink arguments either). Setting it to zero (i.e. pad_projected = 0) produces the expected arrows for me, with Matplotlib version: 3.3.3.

I checked out the blame and this line was added more than ten years ago, so I cannot flag anyone to explain what this was supposed to be doing. If this is for clipping purposes to remedy the "projecting" capstyle, maybe a clip_path can be added instead, as in patch.set_clip_path(patch), thus effectively removing the overflowing edges from the lines drawn (I have used this approach many times before and it is quite effective). A lot of improvements have happened in the last 10 years, and looking at the comment above the line, I doubt this approach is necessary anymore.

@dstansby if the main contributors of matplotlib can agree on a way to go, I can implement the changes. Or, I can just delve into it and create a PR, and see what happens.

EDIT: I think I understand what the line is supposed to be doing and how it fails: .5*linewidth is indeed the overflown edge to be accounted for, as in the half of the edge that resides in the wrong part of the path. However, that linewidth is in point units while the rest of the values are in the coordinates of the axes (possibly cartesian), so it does not actually do anything, and the issue appears only when the scale is small enough for it to be visible.

And here are the more "fun" parts: The default capstyle for arrow patch is not even "projecting" (also see #13647). On top of that, I think the authors of the function was pointing to "joinstyle" rather than "capstyle" (or maybe this change is younger than 10 years?) since the arrow head is a closed path, so there are no "caps" and the arrow head location cannot be affected by capstyle.

So much weird stuff is going on here. Maybe just rewrite everything related to arrows?

@leejjoon
Copy link
Contributor

leejjoon commented Feb 7, 2021

My recollection is vague, but here are what I remembers.

FancyArrowPatch was originally designed for annotations. So some of the parameters are introduced and have default values so that we have more visually pleasing annotation (at least that was my intention 10 years ago). For example, the example below may explain why we needed a shrink parameter.

https://matplotlib.org/gallery/userdemo/annotate_explain.html#sphx-glr-gallery-userdemo-annotate-explain-py

Also, as it was mainly meant to be used in "points" coordinate (since that is what annotate uses to draw arrows), some of the code may not correctly work if the coordinate is different.

I guess pad_projected (it should have been pad_miter as you pointed out) was introduced to prevent the arrow overflowing into the annotated patch independently of its linewidth (maybe "miter" was default joinstyle for arrows at that time?). Clipping is different here as you will loose sharp arrow tips.

Surely, the code need improvements. pad_projected could behave differently based on joinstyles, and an option to turn that behavior off could also be desirable. We may need to revisit its default behavior. Also, it should account for the coordinate correctly.

@github-actions
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Sep 22, 2023
@github-actions github-actions bot added the status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. label Nov 13, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action topic: arrow
Projects
None yet
Development

No branches or pull requests

4 participants