I have solved Laplace's equation on an annulus with a central hole. (The blue-red colourmap part on the plot: https://i.sstatic.net/oD6mz.jpg. I would like to discard part of this plot (anything outside the black circle I've drawn onto the plot), and I want the black x I drew to be the centre of a new, smaller disk, with an off-centre hole in it that used to be a central hole in a bigger disk.
just to be clear, I want to get this: https://i.sstatic.net/oNwxG.jpg and I also wonder if it would be possible to save the values of this cropped disk in another array somehow?:
This is the closest thing to what I need that I have found so far: remove part of a plot in matplotlib however, I don't know how to implement it in my case. I feel like I should define a new mesh grid somehow, but I'm not sure how to tell it to have an off-centre hole in the plot, moreover, this does not help with saving the values of the smaller disk with the off-central hole into a new array.
This is my code for plotting the original annulus:
import numpy as np import matplotlib.pyplot as plt #initial conditions Nr = 50 N_phi = 50 radius = 10 r2 = 2 T1 = 35 T2 = 4 # define for plot r = np.linspace(r2, radius, Nr) phi = np.linspace(0, 2*np.pi, N_phi) R, phi = np.meshgrid(r, phi) X = R*np.cos(phi) Y = R*np.sin(phi) #initialise matrix T = np.ones((Nr, N_phi)) #print(np.shape(T)) #add solution to laplace's equation to matrix T for i in reversed(range(0,Nr)): T[:,i] = T1 + ((T2- T1)/np.log(r2/radius))*np.log(r[i]/radius) #plot plt.figure() yes = plt.contourf(X,Y,T,cmap='jet') plt.colorbar(yes) plt.show() I hope someone can guide me in the right direction. Thanks.