Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross glitch on subplot #41

Open
elvis1020 opened this issue Apr 5, 2024 · 0 comments
Open

cross glitch on subplot #41

elvis1020 opened this issue Apr 5, 2024 · 0 comments

Comments

@elvis1020
Copy link

elvis1020 commented Apr 5, 2024

Hello. I love this scatter density implementation that resembles topcat (from astronomer to astronomer =]).
I came across this cross forming as a glitch, and it changes color/location depending on the zoom/pan, and randomly disappear.
CM_selection

below is the code that I used:

f1, ax1 = plt.subplots(1, 2, figsize=[5.8, 3.1], subplot_kw=dict(projection='scatter_density'), sharex=True, sharey=True)
ax1 = ax1.flatten()
norm = ImageNormalize(vmin=0., vmax=1000, stretch=LogStretch())

polyconf = dict(fc=None, ec='k', fill=False, ls='--')
ax1[0].scatter_density(apo_sel['bp_rp'], apo_sel['absmag'], cmap=colormapsT['all'], norm=norm)
ax1[0].scatter_density(apo_sel.loc[apo_sel['filter']]['bp_rp'], apo_sel.loc[apo_sel['filter']]['absmag'],
                      cmap=colormapsT['green'], norm=norm)
ax1[0].scatter_density(apo_sel.loc[apo_sel['cm_mainsequence']]['bp_rp'], apo_sel.loc[apo_sel['cm_mainsequence']]['absmag'],
                      cmap=colormapsT['blue'], norm=norm)
ax1[0].scatter_density(apo_sel.loc[apo_sel['cm_giants']]['bp_rp'], apo_sel.loc[apo_sel['cm_giants']]['absmag'],
                      cmap=colormapsT['red'], norm=norm)
ax1[0].add_patch(mpatches.Polygon(cm_giants_cut, **polyconf))
ax1[0].add_patch(mpatches.Polygon(cm_mainseq_cut, **polyconf))
ax1[0].text(0.99, 0.99, 'APOGEE', ha='right', va='top', transform=ax1[0].transAxes)

ax1[1].scatter_density(gal_sel['bp_rp'], gal_sel['absmag'], cmap=colormapsT['all'], norm=norm)
ax1[1].scatter_density(gal_sel.loc[gal_sel['filter']]['bp_rp'], gal_sel.loc[gal_sel['filter']]['absmag'],
                      cmap=colormapsT['green'], norm=norm)
ax1[1].scatter_density(gal_sel.loc[gal_sel['cm_mainsequence']]['bp_rp'], gal_sel.loc[gal_sel['cm_mainsequence']]['absmag'],
                      cmap=colormapsT['blue'], norm=norm)
ax1[1].scatter_density(gal_sel.loc[gal_sel['cm_giants']]['bp_rp'], gal_sel.loc[gal_sel['cm_giants']]['absmag'],
                      cmap=colormapsT['red'], norm=norm)
ax1[1].add_patch(mpatches.Polygon(cm_giants_cut, **polyconf))
ax1[1].add_patch(mpatches.Polygon(cm_mainseq_cut, **polyconf))
ax1[1].text(0.99, 0.99, 'GALAH', ha='right', va='top', transform=ax1[1].transAxes)

ax1[0].set_xlim([-0.41, 4.2])
ax1[0].set_ylim([14.4, -5])
ax1[1].yaxis.set_visible(False)
f1.supxlabel('BP-RP [mag]', fontsize=10)
f1.supylabel('G [mag]', fontsize=10)
patches = [mpatches.Patch(color='gray', label='survey + GDR3 rv'),
           mpatches.Patch(color='green', label='Fe and Mg quality filter'),
           mpatches.Patch(color='blue', label='selected MS'),
           mpatches.Patch(color='red', label='selected RGB'),
           Line2D([0], [0], color='k', lw=1.5, ls='--', label='CM selection polygons')]
ax1[0].legend(handles=patches, bbox_to_anchor=(0.05, 1.03), loc='lower left', fontsize=8, ncol=3)
plt.tight_layout()
plt.subplots_adjust(top=0.85,
bottom=0.156,
left=0.1,
right=0.974,
hspace=0.2,
wspace=0.07)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant