python - Is matplotlib.patches.FancyArrow not well behaved? -


i found rare behaviour in matplotlib when trying plot arrows. if make figure below:

import matplotlib.pyplot plt import matplotlib.patches patches  arrow = patches.fancyarrow(0.,0.,0.4,0.6)  fig = plt.figure(1) ax1  = fig.add_subplot(121) ax2  = fig.add_subplot(122)  ax1.add_line(arrow) plt.show() 

you see arrow in first axis. when trying add same arrow on second axis:

import matplotlib.pyplot plt import matplotlib.patches patches  arrow = patches.fancyarrow(0.,0.,0.4,0.6)  fig = plt.figure(1) ax1  = fig.add_subplot(121) ax2  = fig.add_subplot(122)  ax1.add_line(arrow) ax2.add_line(arrow)  plt.show() 

you going note arrows not plotted.

if try make same figure, different copies of arrow object:

import matplotlib.pyplot plt import matplotlib.patches patches  arrow1 = patches.fancyarrow(0.,0.,0.4,0.6) arrow2 = patches.fancyarrow(0.,0.,0.4,0.6)  fig = plt.figure(1) ax1  = fig.add_subplot(121) ax2  = fig.add_subplot(122)  ax1.add_line(arrow1) ax2.add_line(arrow2)  plt.show() 

it possible see both arrows, 1 in each panel. so, seems there dependence between different methods , objects. knows going on here? fancyarrow buggy? thanks.

they behave fine, using them wrong, you can't add same artist object more 1 axes [in future, enforced library].

there bits , pieces of internals of artist , axes mixed when add artist axes. example get_axes returns axes artist in, if added multiple axes tricky(ier) keep track of.

this related why moving axes between figures hard (after creating array of matplotlib.figure.figure, how draw them subplots of 1 figure? , how include matplotlib figure object subplot?)


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -