How to change the arrow color in below demo code?
import matplotlib.pyplot as plt
def save_fig(fig,pngname):
fig.savefig(pngname, dpi=fig.dpi, bbox_inches="tight")
print("[[%s]]"%pngname)
return
def add_arrow(fig,ax,lw,lc):
xmin,xmax = ax.get_xlim()
ax.arrow(xmin,0,xmax-xmin .2,0,#fc='k', ec='k',
lw = lw,head_width=.1,head_length=0.4, overhang = 0,
length_includes_head=False, clip_on = False,edgecolor='k',facecolor=lc)
return
def main():
x = [
#"FLAGS",
"INTENDED_VSYNC",
"VSYNC",
"OLDEST_INPUT_EVENT",
"HANDLE_INPUT_START",
"ANIMATION_START",
"PERFORM_TRAVERSALS_START",
"DRAW_START",
"SYNC_QUEUED",
"SYNC_START",
"ISSUE_DRAW_COMMANDS_START",
"SWAP_BUFFERS",
"FRAME_COMPLETED",
]
lw = 2
lc = "grey"
fig, ax = plt.subplots(1, figsize=(8,.2))
y = [0]*len(x)
ax.plot(x,y,color=lc)
ax.set_ylim([0,0.1])
plt.xticks(rotation=45,ha='right')
ax.tick_params(direction = 'inout',color=lc)
ax.tick_params('both', length=20, width=lw, which='major')
ax.tick_params('both', length=10, width=lw, which='minor')
plt.yticks([], [])
for direction in ["left", "right", "bottom", "top"]:
ax.spines[direction].set_visible(False)
add_arrow(fig,ax,lw,lc)
#save_fig(fig,sdir "/vsync.png")
plt.show()
return
sdir = "/home/tester"
main()
CodePudding user response: