def plotGrid(plt): plt.figure(figsize=(18, 11.25)) # plotUtil.setGridSize(-2, 33, 22, 52) # plotUtil.setGridSize(9, 16, 36, 43) plotUtil.setGridSize(9.3, 12, 40.2, 42.4) plt.xlabel('RA') plt.ylabel('DEC') plotUtil.plotGrid(plt, 0.1)
def plotGalaxy(plt): plt.plot(common.M31_RA, common.M31_DEC, '*', color='r') plt.plot(common.M32_RA, common.M32_DEC, '*', color='r') plt.plot(common.M33_RA, common.M33_DEC, '*', color='r') plotUtil.plotEllipseWithParam(plt, common.M31_RA, common.M31_DEC, common.M31_Width, common.M31_height, common.M31_Angle, (0, 0, 0, 0), (0, 0, 0, 0.4)) plotUtil.plotEllipseWithParam(plt, common.M32_RA, common.M32_DEC, common.M32_Width, common.M32_height, common.M31_Angle, (0, 0, 0, 0), (0, 0, 0, 0.4))
def plotOver(lamostTable, sdssTable, mu): dic_lamost = getCoordinateDic(lamostTable) dic_sdss = getCoordinateDic(sdssTable) dic_over = {} for ra in dic_lamost.keys(): for dec in dic_lamost[ra].keys(): lcount = dic_lamost[ra][dec] scount = util.getDic2Value(dic_sdss, ra, dec) if scount is None: util.setItemToDic2(dic_over, ra, dec, 10) else: util.setItemToDic2(dic_over, ra, dec, float(lcount) / float(scount)) for ra in dic_sdss.keys(): for dec in dic_sdss[ra].keys(): if not util.isInDic2(dic_lamost, ra, dec): util.setItemToDic2(dic_over, ra, dec, 11) for ra in dic_over.keys(): for dec in dic_over[ra].keys(): alpha = dic_over[ra][dec] if alpha == 10: plotUtil.plotRectangleWithParam(plt, ra, dec, 1, 1, "red") elif alpha == 11: plotUtil.plotRectangleWithParam(plt, ra, dec, 1, 1, "blue") else: newAlpha = alpha * mu if newAlpha > 1: newAlpha = 1 plotUtil.plotRectangleWithParam(plt, ra, dec, 1, 1, "black", newAlpha) plt.title("Lamost/SDSS Covered") CommonPlot.plotGrid(plt) CommonPlot.plotGalaxy(plt) plt.savefig('/media/zdwdong/my/fits/Cover/Lamost_OVER_SDSS_' + str(mu) + '.png') plt.close()
x_mean = [] y_mean = [] x_3std1 = [] y_3std1 = [] x_3std2 = [] y_3std2 = [] for key in dic.keys(): value = dic[key] std = np.std(value) value_new = value / std dic[key] = value_new mean = np.mean(value_new) plotUtil.plotText(plt, key, 8.5, round(std, 2)) plotUtil.plotText(plt, key, 9, round(mean, 1)) count_value = len(value) x = [] for i in range(count_value): x.append(key) plt.plot(x, value_new, '.') x_mean.append(key) y_mean.append(mean) x_3std1.append(key) x_3std2.append(key) y_3std1.append(mean + 3)
# coding=utf-8 __author__ = 'zdwdong' """ 画 teff/logg散点图 """ import CodeLib.Database.MySQLHepler as sqlHelper import matplotlib.pyplot as plt import CodeLib.Util.PlotUtil as plotUtil sql_select = "select teff,logg from dr3.M31_ELL where teff>0 and logg>0" data = sqlHelper.getFetchAll(sql_select) teff = [] logg = [] for dataRow in data: teff.append(float(dataRow[0])) logg.append(float(dataRow[1])) plt.title("Lamost Logg_teff") plt.plot(teff, logg, '.') plt.xlabel('teff') plt.ylabel('logg') plotUtil.plotGrid(plt) plotUtil.invertX(plt) plt.show()