Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

python - Prevent Matplotlib to stretch plot to only bbox of drawing area

Please see below image:

enter image description here I set the figure size of plt equal to something like (4,6) and set axis to off and margin to zero. Then continue to draw polyline using coordinate array by ax.plot(line[:,1],line[:,0])

after this I don’t use the plt.show() But convert the plot to numpy array which has correct (4,6) size but surprisingly fill the plot by stretched to only bbox of the draw line

How can i see all the unused space of figure?

Is there any flag that i have to change in somewhere in matplotlib?

Any help appreciated


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The plot of matplotlib will define the output based on shape and size of drawing not based on the pre-defined figure size,some kind of back-end and front-end, or simply it is a responsive-layout when you resize the window everything will scale else those are passed through linewidth= and ...

then i changed my workflow and problem solved ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...