Commit acdd0b9b authored by Mijian Xu's avatar Mijian Xu 😷

add map axis

parent fde130ae
Pipeline #742 passed with stage
in 2 minutes and 36 seconds
import numpy as np
from mgpro import expand
# import expand
from mgpro.proj import *
# from proj import *
# from mgpro import expand
import expand
# from mgpro.proj import *
from proj import *
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from scipy.fftpack import fft2, fftshift, ifft2, ifftshift
......@@ -17,6 +17,11 @@ def msg():
'''
def tick2label(ticks, lim):
labels = ['{:.0f}'.format(tick) for tick in np.linspace(lim[0], lim[1], len(ticks))]
return labels
def cal_pos(max_len, len_x, len_y):
if max_len > 1 or max_len < 0:
raise ValueError('Input arg of max_len must be in the range of 0 to 1')
......@@ -168,8 +173,13 @@ class mgmat(object):
real_width *= frac_w
fig.clf()
ax_raw = fig.gca()
pcm = ax_raw.imshow(data, cmap='jet', extent=[self.x[0], self.x[-1], self.y[0], self.y[-1]])
# ax_raw.figure.canvas.draw()
divnorm = colors.DivergingNorm(vcenter=0)
pcm = ax_raw.pcolor(data, cmap='jet', norm=divnorm)
xticklabels = tick2label(ax_raw.get_xticks(), [self.x[0], self.x[-1]])
yticklabels = tick2label(ax_raw.get_yticks(), [self.y[0], self.y[-1]])
ax_raw.set_xticklabels(xticklabels)
ax_raw.set_yticklabels(yticklabels)
plt.setp(ax_raw.get_xticklabels(), rotation=-45, ha="left")
cb = fig.colorbar(pcm, extend='both')
# ax_raw.set_position([.1, .125, real_width, real_height], which='original')
# cb.ax.set_position([.8, .1, real_height/6.27, real_height])
......
......@@ -5,7 +5,7 @@ packages = find_packages()
with open("README.md", "r") as fh:
long_description = fh.read()
VERSION = "0.1.6"
VERSION = "0.1.7"
setup(name='mgpro',
version=VERSION,
author='Mijian Xu',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment