I have this kind of graph
plot(x,y)
where it is shown the correlation between x and y. I'd like to plot this data in a 3D surface, so something like that:
Here my data:
x <- c(2.94, 2.97, 2.91, 3.03, 2.93, 2.91, 3.14, 3.02, 2.84, 3.33, 2.8, 2.97, 2.83, 3.04, 2.9, 2.79, 2.89, 2.96, 2.92, 2.79, 3.08, 3.1, 3, 2.82, 3.31, 2.94, 3.07, 2.79, 3, 2.98, 2.93, 2.92, 2.9, 2.94, 2.91, 2.96, 2.9, 3.16, 3.01, 2.84, 3.01, 3.17, 3.51, 2.92, 3, 3.03, 2.84, 3.02, 2.81, 2.93, 2.95, 2.91, 3.15, 2.95, 2.96, 3.07, 3.01, 2.8, 3.17, 3.02, 2.92, 3.03, 2.92, 2.97, 3.08, 3.11, 3.05, 2.94, 2.93, 2.9, 2.91, 2.84, 3, 3.17, 3.17, 2.92, 3.02, 2.89, 2.97, 3.07, 3.29, 2.98, 2.88, 2.91, 3.1, 2.93, 3.01, 3.04, 3, 2.89, 3.06, 3.06, 3.01, 3.1, 2.81, 2.87, 3.21, 2.91, 3.04, 2.97, 3, 2.99, 2.79, 2.88, 3.09, 2.95, 3.07, 2.88, 2.99, 2.97, 3.15, 2.85, 3.69, 2.89, 3.01, 3.01, 3.11, 2.75, 2.81, 3, 2.93, 2.84, 3.09, 2.86, 3.01, 3.29, 2.95, 3.13, 3.11, 2.8, 3.02, 3.38, 3.07, 2.82, 3.36, 2.84, 2.86, 3.04, 2.96, 2.94, 3.1, 2.77, 3.83, 3, 3.05, 3.14, 2.79, 2.99, 3.11, 2.88, 2.89, 2.98, 2.99, 3.01, 3.1, 2.72, 2.92, 2.84, 2.87, 2.82, 3.01, 3.05, 2.94, 2.79, 3.02, 3.02, 2.85, 2.91, 3, 2.86, 2.82, 2.89, 3.13, 3.03, 2.78, 3.79, 3.1, 3.05, 3.21, 2.9, 2.92, 3.17, 3.23, 3.13, 3.15, 2.86, 3.03, 3.03, 2.94, 3.05, 3.05, 2.84, 3.02, 3.55, 3.1, 3.14, 2.92, 3.22, 3.08, 2.87, 2.89, 2.92, 3.08, 2.99, 2.92, 2.9, 2.83, 2.92, 3.44, 3.1, 2.89, 2.84, 2.96, 2.92, 3.25, 3.04, 3.16, 3.04, 3.04, 2.84, 2.92, 2.83, 3.5, 2.86, 2.98, 2.81, 3.38, 2.93, 2.89, 2.84, 2.98, 2.82, 2.91, 3.1, 3.1, 3.05, 3.05, 2.98, 3.3, 2.8, 3.03, 3.03, 2.87, 3.18, 3.05, 3.94, 2.95, 2.87, 2.75, 2.89, 3.16, 2.87, 2.97, 3.05, 2.83, 3.03, 2.83, 2.97, 2.79, 2.73, 3.75, 3.13, 3.1, 3.06, 3.19, 2.91, 2.99, 3.64, 2.99, 2.95, 3.04, 3.01, 2.82, 3.32, 2.79, 2.87, 3.01, 2.86, 2.91, 2.99, 3.33, 2.78, 3.02, 2.86, 3.03, 3.94, 2.86, 2.83, 3, 2.99, 2.77, 3.07, 2.97, 2.93, 2.88, 2.97, 3.05, 2.89, 2.98, 2.83, 2.97, 2.88, 3.03, 2.96, 3.27, 2.91, 2.8, 2.87, 2.8, 3.05, 3.04, 2.8, 2.78, 2.98, 3.14, 2.79, 3.01, 3.38, 3.07, 3.33, 3.46, 2.88, 2.86, 2.92, 2.98, 2.83, 3.48, 3.68, 3.66, 3.44, 2.83, 2.98, 2.99, 2.88, 2.88, 3.32, 2.94, 2.9, 3.15, 2.94, 3.44, 2.97, 2.87, 3.01, 2.85, 2.96, 2.92, 3, 3.1, 3, 3.05, 3.13, 3.15, 2.95, 3.01, 2.95, 3.62, 3.34, 3.04, 2.89, 3, 3, 2.95, 3.02, 2.94, 4.03, 2.85, 3.56, 2.95, 3.07, 3.45, 3, 3.03, 2.88, 3, 2.9, 3.04, 2.92, 2.95, 2.87, 2.99, 3.03, 3.28, 2.99, 2.78, 3.04, 3.17, 2.94, 3.04, 2.96, 3.08, 2.98, 3.15, 2.9, 2.85, 2.79, 3.01, 3.1, 2.9, 2.77, 3.4, 2.84, 3.03, 2.95, 3.64, 3.05, 2.86, 3.16, 3.19, 3.86, 2.85, 2.97, 2.89, 2.99, 3.15, 3.09, 2.94, 2.89, 2.79, 2.95, 3.13, 3.14, 2.92, 2.89, 3.66, 2.81, 3.18, 2.94, 3.49, 2.95, 2.88, 2.9, 3.56, 2.96, 2.87, 3.1, 2.93, 2.83, 2.4, 2.8, 3.11, 2.8, 3.01, 3.3, 2.78, 3.02, 2.83, 2.76, 2.98, 3.12, 2.74, 2.9, 2.98, 3.02, 2.87, 2.79, 3.26, 3.1, 3, 2.95, 2.9, 2.86, 2.92, 3.17, 2.84, 3.06, 3.05, 3.19, 3.26, 3.03, 2.81, 2.84, 2.96, 3, 3.04, 3.17, 2.9, 2.97, 2.88, 3.35, 3.5, 3.03, 2.96, 2.91, 2.95, 2.73, 2.83, 2.92, 2.95, 2.92, 2.71, 2.92, 3.31, 2.92, 2.96, 3.14, 3.59, 2.9, 3.32, 3.09)
y <- c(124.85, 101.74, 120.55, 118.25, 113.5, 117.44, 124.18, 129.54, 103.87, 129.95, 108.09, 125.37, 107.32, 124.53, 107.38, 108.77, 106.06, 122.41, 114.06, 101.56, 122.89, 123.57, 125.51, 109.86, 131.72, 123.38, 125.91, 113.78, 120.41, 119.65, 120, 111.72, 108.43, 119.34, 111.78, 112.81, 118.88, 117.14, 124.69, 109.52, 125.96, 103.46, 148.63, 124.85, 118.46, 128.8, 111.39, 118.69, 112.42, 120.57, 104.94, 115.02, 121.54, 114.46, 121.63, 127.67, 123.22, 114.01, 129.18, 119.88, 120.36, 120.76, 102.62, 111.06, 122.05, 114.71, 127.26, 125.73, 117.37, 115.31, 114.14, 101.55, 117.03, 133.01, 124.92, 118.63, 122.2, 118.39, 120.03, 120.68, 122.39, 123.22, 117.62, 113.71, 125.11, 120.36, 120.11, 126.24, 118.28, 115.88, 130.6, 124.52, 107.59, 118.55, 103.34, 120.34, 126.63, 104.71, 119.43, 118.91, 118.94, 122.87, 102.63, 112.88, 121.92, 122.31, 109.42, 110.85, 112.54, 117.08, 132.16, 107.13, 107.63, 110.36, 119.72, 122, 128.7, 111.38, 108.77, 121.7, 116.44, 113.75, 124.86, 107.14, 113.78, 133.87, 115.98, 131.15, 113.76, 107.77, 125.59, 116.17, 123.33, 109.91, 125.39, 109.16, 104.48, 117.72, 112.53, 84.4, 120.44, 92.59, 132.08, 119.96, 124.51, 134.56, 110.28, 122.99, 128.65, 123.33, 121.97, 119.89, 116.22, 120.41, 130.69, 97.34, 117.1, 115.2, 117.31, 102.84, 128.42, 122.89, 127.83, 105.85, 121.79, 117.39, 113.14, 116.91, 119.62, 115.34, 118.15, 118.55, 124.39, 124.55, 101.69, 106.25, 122.77, 120.49, 129.15, 127.06, 118.89, 125.05, 129.19, 121.89, 121.48, 99.49, 124.92, 118.89, 116.32, 125.59, 123.55, 105.17, 125.42, 107.64, 123.91, 125.9, 121.95, 124.16, 127.92, 117.47, 116.13, 114.78, 114.62, 123.07, 116.89, 105.84, 109.81, 123.27, 141.14, 126.05, 117.73, 113.18, 123.85, 115.25, 137.36, 121.95, 122.97, 123.55, 120.1, 104.15, 118.79, 108.37, 137, 113.28, 121.64, 104.41, 100.38, 108.85, 115.27, 101.77, 99.28, 105.81, 119.2, 111.01, 125.95, 121.67, 126.79, 121.26, 121.88, 111.03, 119.82, 123.93, 113.2, 133.49, 123.21, 134.39, 118.29, 114.87, 103.6, 110.13, 126.2, 114.74, 121.29, 126.37, 114.36, 128.26, 106.23, 121.49, 101.88, 102.97, 137.83, 129.41, 112.92, 127.03, 128.74, 107.74, 125.19, 106.18, 124.15, 123.41, 124.56, 121.84, 109.04, 115.48, 109.7, 104.62, 116.56, 107.43, 115.69, 124.08, 118.58, 103.84, 124.08, 108.61, 122.31, 135.35, 105.27, 110.7, 125.7, 119.08, 111.51, 130.97, 116.94, 122.07, 113.99, 115.95, 122.85, 111.19, 121.75, 111.75, 117.83, 110.69, 111.5, 126.57, 131.58, 119.19, 108.75, 108.7, 105.36, 120.57, 125.49, 104.8, 108.36, 126.02, 133.16, 110.92, 121.36, 95.67, 126.28, 135.09, 107.4, 111.54, 112.4, 115.56, 118.92, 108.42, 131.21, 136.66, 130.08, 126.17, 110.41, 114.5, 121.48, 119.72, 112.56, 151.05, 114.1, 113.34, 129.38, 121.06, 137.82, 120.31, 115.5, 127.41, 105.95, 112.37, 121.87, 117.24, 125.08, 103.71, 127.93, 139.34, 124.31, 120.41, 116.94, 117.34, 138.18, 112.99, 122.57, 112.89, 101.68, 119.67, 117.25, 123.83, 119.78, 117.72, 113.24, 97.66, 119.22, 125.76, 119.33, 109.15, 130.83, 114.83, 119.37, 115.88, 116.39, 123.71, 119.75, 105.04, 126.48, 122.04, 96.17, 121.19, 107.3, 123.61, 127.35, 112.96, 122.81, 118.63, 127.47, 122.44, 130.99, 114.73, 113.67, 112.25, 124.99, 124.12, 111.79, 100.65, 134.32, 114.88, 123.69, 116.58, 100.2, 119.72, 110.89, 95.61, 130.53, 134.92, 107.92, 116, 115.36, 114.59, 128.64, 124.01, 122.53, 109.97, 99.16, 117.63, 132.35, 115.74, 115.85, 110.51, 109.81, 112.09, 127.93, 116.72, 99.05, 113.51, 108.74, 105.35, 136.62, 113.67, 114.38, 130.61, 114.46, 111.3, 99.47, 106.7, 124.22, 106.95, 121.38, 131.68, 105.73, 114.37, 111.72, 109.45, 126.34, 127.45, 105.86, 119.69, 119.6, 124.16, 109.66, 102.23, 111.24, 111.39, 106.12, 126.03, 107.79, 113.43, 105.7, 140.79, 104.24, 116.63, 119.95, 110.05, 122.24, 117.08, 109.72, 111.24, 114.46, 114.1, 130.48, 117.25, 109.69, 121.79, 113.68, 128.34, 137.2, 116.43, 122.59, 122.8, 114, 107.43, 108.38, 115.43, 110.72, 122.44, 107.39, 116.82, 135.53, 123.22, 118.87, 110.98, 140.92, 102.6, 132.94, 128.68)
Is there a dedicated R package? How I can do?
I'm guessing that you are looking for 2D density of the x, y points. In which case, you could do: