#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') from adjustText import adjust_text # In[2]: sns.set() # Increase font size and linewidth sns.set_context("talk") sns.set_style("whitegrid") # Use LaTeX, setup to use Helvetica. This can be safely commented to make # the installation footprint of running this code smaller -- for example, # in Docker. mpl.rc("text", usetex=True) mpl.rcParams["text.latex.preamble"] = [ r"\usepackage{amsmath}", r"\usepackage{helvet}", r"\usepackage[EULERGREEK]{sansmath}", r"\sansmath", r"\renewcommand{\familydefault}{\sfdefault}", r"\usepackage[T1]{fontenc}", r"\usepackage{graphicx}", ] # In[3]: y = [-3.23699263, -0.54456433, 0.20217487, -1.44078391, -0.78948806, -0.81549368, -0.97963177, -2.32024519, 0.34184152, 0.46509836, -1.76327222, -1.56498244, -3.02585238, -2.86919078, -3.47999394, -3.77758859, -2.5877522 , -1.80491232, -2.526196 , -3.06515993, -2.36805878, -2.70040166, -3.91359614, -2.22447965, 0.7640068 , -2.38088152, -0.92465422, -1.19117003, -2.93342067, -2.01116791, -3.54750411, -3.82991756, -3.94651576, -1.78754848, -0.84244187, -3.01377016, -3.52857263, -4.54753495, -3.43264859, -4.50096442, -1.81978513, -2.6241278 , -0.2903559 , -2.31358002, -1.7794558 , -1.16060225, -1.47757417, -1.38101259, -3.02237171, -2.68588094, -2.94559638, -3.52893628, -1.86992102, -1.94929421, -2.19472414, -1.33931439, -3.38591933, -2.21107682, -1.68876558, -2.82784556, -2.78404039, -2.79673503, -3.3122249 , -3.4467254 , -3.15764325, -2.48772997, -1.90925866, -3.30145098, -2.67868524, -2.39169231, -4.14278251, -2.02767067, -2.71383148, -2.79790091, -1.61335746, -2.13741747, -3.30559616, -3.13831503, -2.14559937, -2.86021049, -3.54868509, -2.91169486, -2.57786984, -1.54087007, -1.92992343, -1.08725733] x = [-0.0161027, -0.6169925, -0.3350268, -0.8463236, -0.2649001, 0.263536 , -0.5799436, -1.6652319, -1.1174503, 0.3427462, -1.8420998, -0.9363596, -2.8243131, -2.1775888, -2.258214 , -3.8064848, -2.8686834, -2.4651664, -2.4879757, -2.988915 , -1.8456243, -3.0724616, -3.1280186, -2.3726023, 0.6530084, -1.5620065, -0.622306 , -0.8369253, -3.2377346, -2.4213402, -2.4820995, -3.4885414, -2.6058268, -0.1664973, -0.5603354, -2.3255117, -3.0258249, -3.9816332, -3.7844925, -4.8114521, -0.9196491, -1.0646948, -1.1131432, -1.541888 , -1.5861297, -1.0254831, -0.2885203, -1.5484045, -2.7793058, -2.8406313, -2.956916 , -3.4659735, -2.155047 , -1.593361 , -1.4957267, -0.6940514, -3.3304536, -1.8914391, -1.6630039, -2.233587 , -2.515146 , -2.1678027, -2.9482368, -3.1193589, -2.7309703, -1.374944 , -1.0082914, -1.8818131, -2.6820504, -2.0042225, -2.9587328, -1.6377112, -2.0194303, -2.7068954, -1.3345921, -1.2353552, -2.4949591, -2.6567135, -1.8066403, -1.9879283, -3.2668661, -2.2376836, -1.8738583, -0.9246734, -1.4970534, -0.8857849] # In[4]: x_label = [-1.064695, -2.258214, -3.128019, -3.981633] y_label = [-2.624128, -3.479994, -3.913596, -4.547535] text = ["a-pam-p", "a-ham-p", "a-hpa-p", "a-oam-p"] # In[7]: fig, ax = plt.subplots(1, figsize=(6 * 1.2, 6)) ax.errorbar(x, y, c="0.5", fmt="o", markersize=8, markeredgecolor="k", markeredgewidth=0.2) texts = [] colors = sns.color_palette("husl") for index, (i, j, k) in enumerate(zip(x_label, y_label, text)): ax.errorbar(i, j, c = colors[index], fmt="o", markersize=8, markeredgecolor="k", markeredgewidth=0.2) texts.append(plt.text(i, j, k, size=28, color = colors[index], bbox=dict(facecolor="w", alpha=0.8))) ax.plot([-50, 50], [-50, 50], ls="-", c="0.3", zorder=-1, lw="0.5") ax.set_ylim(-8, 2) ax.set_xlim(-8, 2) adjust_text(texts) # In[ ]: