%otegi,et,al,2019,table,1

a = {
'TRAPPIST-1','d',0.297,0.039,-0.035,0.784,0.023,-0.023;
'TRAPPIST-1','h',0.331,0.056,-0.049,0.773,0.026,-0.027;
'TRAPPIST-1','e',0.772,0.079,-0.075,0.91,0.026,-0.027;
'TRAPPIST-1','f',0.934,0.078,-0.08,1.046,0.029,-0.03,
'TRAPPIST-1','b',1.017,0.154,-0.143,1.121,0.032,-0.032,
'TRAPPIST-1','g',1.148,0.098,-0.095,1.127,0.041,-0.041,
'TRAPPIST-1','c',1.156,0.142,-0.131,1.095,0.031,-0.031,
'LHS1140','c',1.81,0.39,-0.39,1.282,0.024,-0.024,
'GJ357','b',1.84,0.31,-0.31,1.217,0.084,-0.083,
'Kepler-78','b',1.87,0.27,-0.26,1.2,0.08,-0.09,
'K2-229','b',2.59,0.43,-0.43,1.14,0.06,-0.03,
'Kepler-10','b',3.24,0.28,-0.28,1.489,0.07,-0.06,
'Kepler-80','d',3.7,0.8,-0.6,1.3,0.1,-0.1,
'Kepler-36','b',3.9,0.2,-0.2,1.5,0.1,-0.1
'Kepler-93','b',4.02,0.68,-0.68,1.478,0.019,-0.019
'Kepler-65','d',4.14,0.79,-0.8,1.587,0.04,-0.035,
'HD219134','c',4.36,0.22,-0.22,1.511,0.047,-0.047,
'HD219134','b',4.74,0.19,-0.19,1.602,0.055,-0.055,
'HD39091','c',4.82,0.84,-0.86,2.042,0.05,-0.05
'GJ9827','b',4.89,0.477,-0.477,1.575,0.03,-0.02,
'HD3167','b',5.02,0.38,-0.38,1.7,0.08,-0.08,
'K2-141','b',5.08,0.41,-0.41,1.51,0.05,-0.05,
'CoRoT-7','b',5.74,0.86,-0.86,1.585,0.064,-0.064,
'GJ1214','b',6.26125,0.85814,-0.85814,2.847,0.202,-0.202,
'K2-291','b',6.49,1.16,-1.16,1.589,0.095,-0.072,
'K2-131','b',6.5,1.6,-1.6,1.81,0.16,-0.12,
'K2-265','b',6.54,0.84,-0.84,1.71,0.11,-0.11,
'Kepler-11','e',6.7,1.2,-1.0,4.0,0.2,-0.3,
'Kepler-11','d',6.8,0.7,-0.8,3.3,0.2,-0.2
'WASP-47','e',6.83,0.66,-0.66,1.81,0.027,-0.027,
'Kepler-454','b',6.84,1.4,-1.4,2.37,0.13,-0.13
'LHS1140','b',6.98,0.89,-0.89,1.727,0.032,-0.032,
'Kepler-36','c',7.5,0.3,-0.3,3.2,0.2,-0.2
'HD97658','b',7.55,0.83,-0.79,2.247,0.098,-0.095
'HD15337','b',7.20,0.81,-0.81,1.70,0.06,-0.06,
'K2-216','b',8.0,1.6,-1.6,1.75,0.17,-0.1
'Kepler-19','b',8.4,1.6,-1.5,2.2,0.07,-0.07,
'55Cnc','e',8.59,0.43,-0.43,1.947,0.038,-0.038,
'HD15337','c',8.79,1.68,-1.68,2.52,0.11,-0.11,
'HD213885','b',8.83,0.66,-0.65,1.745,0.051,-0.052
'EPIC220674823','b',9.0,1.6,-1.6,1.82,0.1,-0.1
'Kepler-107','c',9.39,1.77,-1.77,1.597,0.026,-0.026,
'K2-285','b',9.68,1.2,-1.3,2.59,0.06,-0.06,
'Kepler-20','b',9.7,1.41,-1.44,1.868,0.066,-0.034
'HD3167','c',9.8,1.3,-1.23,2.86,0.22,-0.22,
'Kepler-94','b',10.84,1.4,-1.4,3.186,0.13,-0.25,
'K2-180','b',11.448,1.9,-1.9,2.24,0.12,-0.12,
'HIP116454','b',11.82,1.33,-1.33,2.53,0.18,-0.18,
'Kepler-20','c',12.75,2.17,-2.24,3.047,0.064,-0.056,
'Kepler-95','b',13.0,2.9,-2.9,3.145,0.144,-0.132,
'KOI-94','e',13.0,2.5,-2.1,6.31,0.3,-0.3,
'WASP-47','d',13.1,1.5,-1.5,3.576,0.046,-0.046
'GJ3470','b',13.9,1.5,-1.5,4.57,0.18,-0.18,
'Kepler-48','c',14.61,2.3,-2.3,2.522,0.113,-0.107,
'K2-263','b',14.8,3.1,-3.1,2.41,0.12,-0.12,
'Kepler-18','d',14.9,1.8,-4.2,6.0,0.4,-0.4
'K2-24','c',15.4,1.9,-1.8,7.5,0.3,-0.2
'K2-285','c',15.68,2.28,-2.13,3.53,0.08,-0.08,
'Kepler-131','b',16.13,3.5,-3.5,2.1,0.2,-0.1,
'K2-32','b',16.5,2.7,-2.7,5.13,0.28,-0.28,
'HD219666','b',16.6,1.3,-1.3,4.71,0.17,-0.17,
'K2-110','b',16.7,3.2,-3.2,2.59,0.01,-0.01,
'Kepler-10','c',17.2,1.9,-1.9,2.35,0.09,-0.04
'K2-24','b',19.0,2.1,-2.0,5.4,0.2,-0.2
'GJ143','b',22.7,2.2,-1.9,2.61,0.17,-0.16
'GJ436','b',23.1,0.8,-0.8,4.191,0.1,-0.1
'HD21749','b',23.2,2.13,-1.91,2.84,0.16,-0.16,
'Kepler-4','b',24.472,3.814,-3.814,4.002,0.213,-0.213
'HD119130','b',24.5,4.4,-4.4,2.63,0.11,-0.1
'Kepler-25','c',24.6,5.7,-5.7,5.154,0.06,-0.06,
'Kepler-411','b',25.758,2.544,-2.544,2.3968,0.056,-0.056,
'Kepler-411','c',26.394,6.042,-6.042,4.418,0.06,-0.06,
'HAT-P-11','b',27.76,3.08,-3.08,4.35,0.05,-0.05,
'K2-27','b',30.9,4.6,-4.6,4.48,0.23,-0.23,
'WASP-166','b',32.436,1.272,-1.272,7.056,0.336,-0.336,
'HD89345','b',34.9613,5.40311,-5.72094,7.398,0.314,-0.336,
'WASP-139','b',37.18611,5.40311,-5.40311,8.967,0.56,-0.56,
'WASP-107','b',38.0,3.0,-3.0,10.6,0.3,-0.3
'HATS-7','b',38.1,3.8,-3.8,6.31,0.5,-0.4
'Kepler-35','b',40.363,6.356,-6.356,8.16,0.157,-0.157,
'WASP-156','b',40.68224,3.1783,-2.86047,5.717,0.224,-0.224,
'K2-55','b',43.88,5.4,-5.4,4.424,0.29,-0.29,
'Kepler-101','b',51.1,5.1,-4.7,5.986,0.27,-0.25,
'HAT-P-48','b',53.4,7.6,-7.6,12.66,0.6,-0.6
'KELT-11','b',54.3,4.8,-4.8,15.1,1.1,-1.1
'K2-261','b',56.922,6.36,-6.36,9.4,0.12,-0.12,
'WASP-127','b',57.2094,6.3566,-6.3566,15.356,0.448,-0.448,
'K2-108','b',59.4,4.4,-4.4,5.33,0.21,-0.21,
'HAT-P-18','b',62.3,2.5,-2.5,11.153,0.583,-0.583
'HD221416','b',63.4,5.7,-5.7,9.16,0.34,-0.31,
'HAT-P-47','b',65.508,12.4,-12.4,14.7,0.4,-0.4
'HAT-P-12','b',67.059,3.814,-3.814,10.749,0.325,-0.235,
'CoRoT-8','b',69.92,9.53,-9.53,6.39,0.22,-0.22,
'Kepler-34','b',69.92,3.496,-3.178,8.564,0.135,-0.157,
'Kepler-425','b',71.8,14.6,-14.6,10.255,0.47,-0.45,
'NGTS-5','b',72.8,11.8,-11.8,12.73,0.26,-0.26,
'HATS-5','b',75.323,3.814,-3.914,10.223,0.28,-0.28,
'WASP-29','b',77.9,7.3,-7.0,8.8,0.6,-0.4
'WASP-69','b',82.632,5.4,-5.4,9.11,0.3,-0.3
'HATS-43','b',83.0,17.0,-17.0,13.23,0.56,-0.56,}

m = cell2mat(a(:,3));
r = cell2mat(a(:,6));
rho  = 5.51.*m./r.^3;
delrho = rho.*sqrt(abs(cell2mat(a(:,4))./m).^2 + 3*(abs(cell2mat(a(:,7))./r).^2))
rhou =  delrho;
rhol = delrho;

figure;scatter(r,rho,'ro','filled');xlim([0.5 4])
box on;set(gcf,'color','white')
hold on

errorbarxy(r,rho,cell2mat(a(:,7)),rhol,-cell2mat(a(:,8)),rhou,'w','r')
hold on
scatter(1,5.51,'k*')
line([0:1e-3:3],5.51*([0:1e-3:3].^(1/0.27))./([0:1e-3:3].^3))
for l = 1:length(rho)
    text(r(l),rho(l),strcat(cell2mat(a(l,1)),cell2mat(a(l,2))))
end

grid on
xlabel('Planet radius (Earth radii)')
ylabel('Planet density (g/cm^3)')
set(gca,'fontsize',14)
ylim([2 13])
xlim([0.7 2.5])

