I need to create a figure with 2 columns subplots, where the first subplot display a "normal" (non-spatial) plot, and the second is a map.
They should be side by side and I would need them to have the same height.
In the figure below, I'd like to adjust the height of the plot on the left to fit the height of the map on the right.
I guess the subplots might already be the same size, but as you can see, the border of the plot on the left is bigger than that of the map, and I'd like its height to be the same as the one on the right.
The code I am running is this one.
import numpy as np
fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot(np.arange(10))
gdf.plot(ax=ax2)
Solution found here !
fig.subplots_adjust(hspace=0.0, wspace=0.0)
However , if I need to adjust the figure size with figsize
, this would "break" the map proportion, so I resize the figure preserving its ratio with:
RESIZE_FACTOR = 2.5
fig.set_size_inches(fig.get_size_inches()*RESIZE_FACTOR)
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.