Is there a way to make the x=0 and y=0 (the ordinate and abscissa) axes in a Cartesian plot bold?
For example, a simple plot is:
x = np.arange(0.01, 5, 0.1)
y = np.log(x)
plt.plot(x,y)
plt.grid()
Which looks like:
I can add this 'hack':
x = np.arange(0.01, 5, 0.1)
y = np.log(x)
plt.plot(x,y)
plt.grid()
plt.plot(x,0*x, 'k')
plt.plot(x*0,x, 'k')
plt.plot(x*0,-x, 'k')
Then I get:
Is there a way to make this a bit less hacky - an API or a more sophisticated solution?
不错的答案,我想补充一下,除了调整lw设置线宽以供选择外,您还可以在axhline
和axvline
关键字中传递color
(例如color='k'
)以保持黑色
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.