[PYTHON] Adjust the spacing between figures with Matplotlib

Return to list

image.png

import matplotlib.pyplot as plt
%matplotlib inline

plt.subplots_adjust(wspace=0.4,hspace=0.6)

plt.subplot(2,2,1)
plt.scatter(1,1)

plt.subplot(2,2,2)
plt.scatter(1,1)

plt.subplot(2,2,3)
plt.scatter(1,1)

plt.subplot(2,2,4)
plt.scatter(1,1)
plt.show()

image.png

import matplotlib.pyplot as plt
%matplotlib inline

plt.subplots_adjust(wspace=0.15,hspace=0.15)
min = 0.8
max = 1.2

plt.subplot(2,2,1)
plt.scatter(1,1)
plt.tick_params(bottom=False,labelbottom=False)
plt.xlim(min,max)
plt.ylim(min,max)

plt.subplot(2,2,2)
plt.scatter(1,1)
plt.tick_params(bottom=False,labelbottom=False,left=False,labelleft=False)
plt.xlim(min,max)
plt.ylim(min,max)

plt.subplot(2,2,3)
plt.scatter(1,1)
plt.xlim(min,max)
plt.ylim(min,max)

plt.subplot(2,2,4)
plt.scatter(1,1)
plt.tick_params(left=False,labelleft=False)
plt.xlim(min,max)
plt.ylim(min,max)
plt.show()

Recommended Posts

Adjust the spacing between figures with Matplotlib
Adjust the ratio of multiple figures with the matplotlib gridspec
Adjust axes with matplotlib
How to title multiple figures with matplotlib
[Python] Set the graph range with matplotlib
Align the size of the colorbar with matplotlib
Set the xticklabels color individually with matplotlib
Display markers above the border with matplotlib
Match the colorbar to the figure with matplotlib
Adjust the bin width crisply and neatly with the histogram of matplotlib and seaborn
Drawing tips with matplotlib on the server side
Increase the font size of the graph with matplotlib
Adjust file permissions with the Linux command chmod
Animation with matplotlib
Japanese with matplotlib
The basis of graph theory with matplotlib animation
Animation with matplotlib
Visualize the behavior of the sorting algorithm with matplotlib
Histogram with matplotlib
Animate with matplotlib
Calculate the angle between n-dimensional vectors with TensorFlow
matplotlib: Replace the axis itself with another one.
Add information to the bottom of the figure with Matplotlib
Display the graph while changing the parameters with PySimpleGUI + Matplotlib
2-axis plot with Matplotlib
Heatmap with Python + matplotlib
Band graph with matplotlib
Learn with Cheminformatics Matplotlib
Real-time drawing with matplotlib
Various colorbars with Matplotlib
3D plot with matplotlib
Calculate the time difference between two columns with Pandas DataFrame
[Python] Read the csv file and display the figure with matplotlib
Reformat the timeline of the pandas time series plot with matplotlib
Let's visualize the number of people infected with coronavirus with matplotlib
I wrote the basic operation of matplotlib with Jupyter Lab