0

I've prodeced a map with the following code:

f, ax = plt.subplots(1, figsize = (12, 12))
eng.plot(ax=ax, facecolor = 'dimgray', linewidth = 0.5, edgecolor = 'dimgray')
blbog.plot(ax=ax, color= 'k', alpha = 0.5)
blbog_unpro.plot(ax=ax, column = 'mean_flow', scheme = 'fisher_jenks', k=5, legend = True, cmap = 'plasma', alpha = 0.75)

axins = ax.inset_axis
plt.show()

Which produces this map: enter image description here

I'd like to add an insert that zooms in on part of the map. I've seen the documentation here and therefor have addedd in the following lines to try and do this:

import matplotlib.pyplot as plt

from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset

fig, ax = plt.subplots(1,figsize=[12, 12])

eng.plot(ax=ax, facecolor = 'dimgray', linewidth = 0.5, edgecolor = 'dimgray')
blbog.plot(ax=ax, color= 'k', alpha = 0.5)
blbog_unpro.plot(ax=ax, column = 'mean_flow', scheme = 'fisher_jenks', k=5, legend = False, cmap = 'plasma', alpha = 0.75)

axins = zoomed_inset_axes(ax, 6, loc=1) # zoom = 6
axins.plot()

x1, x2, y1, y2 = 358000, 425000, 500000, 550000
axins.set_xlim(x1, x2)
axins.set_ylim(y1, y2)
axins.set_xticklabels('')
axins.set_yticklabels('')

ax.indicate_inset_zoom(axins)

plt.show()

The problem I have is that I don't know what to include in the axins.plot() command. In the examples they just include the data they have plotted again, but including the lines I used to make the above plot returns an error.

Does anyone have any clues?

tom91
  • 685
  • 7
  • 24
  • 2
    Did you try `blbog.plot(ax=axins)` and `blbog_unpro.plot(ax=axins, column = 'mean_flow', scheme = 'fisher_jenks', k=5, legend = False, cmap = 'plasma', alpha = 0.75)`? – Sheldore Dec 13 '18 at 13:46
  • That is exactly what I should have done, I am a complete muppet. Thank you. – tom91 Dec 13 '18 at 13:48

0 Answers0