MATLAB: Plotting a Hexagon shape in matlab

hexagonplot

Hi everyone, I have this user distribution on the plane (as shown in the figure). I want to draw a Hexagon shape around these marks. Don't know how to put in there. Thank you so much.

Best Answer

To Draw any polygon:
scale = 5;
N_sides = 6;
t=(1/(N_sides*2):1/N_sides:1)'*2*pi;
x=sin(t);
y=cos(t);
x=scale*[x; x(1)];
y=scale*[y; y(1)];
plot(x,y)
axis square
Now just hold on and off your data plot. Adjust the scale to your data