I want to use a hexbin plot with a 'symlog' scale. Native options allow to use a 'log' scale but not a 'symlog'. Do you see an easy method to obtain it ? The best that I can do is to produce 2 plots and put one next to the other. Here is a minimum reproducible example :
The initial scatter plot
x = np.exp(np.random.randn(10000)) * (2*np.random.randint(0,2,size=(10000))-1) # positive or negative
y = np.exp(np.random.randn(10000)) + np.abs(x)*1 # my "y" are positive, "+ np.abs(x)" is used for setting a particular pattern of spatial distribution
c = np.exp(np.random.randn(10000)) * (2*np.random.randint(0,2,size=(10000))-1) # positive or negative
my_norm = matplotlib.colors.SymLogNorm(2,vmin=-50,vmax=50,base=10) # setting a symlog norm for the colorbar
plt.figure(figsize=(15,8))
plt.scatter(x,y,c=c,norm=my_norm,cmap='bwr')
plt.xscale('symlog')
plt.yscale('log')
cbar = plt.colorbar()
plt.gca().set_facecolor('silver')
The best hexbin plot miming the symlog scale that I could produce
plt.figure(figsize=(15,8))
plt.subplot(1,2,1)
mask_left = x<0
x_left = x[mask_left]
y_left = y[mask_left]
c_left = c[mask_left]
plt.hexbin(-x_left,y_left,C=c_left,gridsize=30,xscale='log',yscale='log',cmap='bwr',norm=my_norm)
plt.gca().invert_xaxis()
plt.gca().set_facecolor('silver')
plt.subplot(1,2,2)
mask_right = x>0
x_right = x[mask_right]
y_right = y[mask_right]
c_right = c[mask_right]
plt.hexbin(x_right,y_right,C=c_right,gridsize=30,xscale='log',yscale='log',cmap='bwr',norm=my_norm)
plt.gca().set_facecolor('silver')
Thanks in advance for your help !