MATLAB: How to change the linewidth of the plot, without affecting the marker type and size

linewidthmarkerMATLABplotxtick

I am trying to make nice looking plots, and I know exactly how I want them. I want open squares for the data points, and the points to be connected by thicker lines than the default. This seems to be really hard to do, because as soon as I specify the line width, the squares turn into (very pixelated) circles with a thick line.
xvalues = [-4 0 -4];
yvalues = [4 2 0];
h = plot([xvalues,yvalues],'-s);
h.LineWidth = 2;
If I comment out the LineWidth, I get the squares as I want them, but the line too thin. If I include it the squares disappears.
I am also having trouble using the XTick-setting. I've added …
ax = gca;
ax.XTick = [-4 -2 0 -2 -4];
… but nothing happens.
Would appreciate any help in resolving this. I'm using MATLAB R2016a.

Best Answer

xvalues = [-4 0 -4];
yvalues = [4 2 0];
h = plot([xvalues,yvalues],'-s','MarkerSize',2);
h.LineWidth = 10;
XTick = [-4 -2 0 -2 -4];
set(gca,'XTickLabel',XTick)