How can I change the linewidth of my plot, without affecting the marker type and size?

6 次查看(过去 30 天)
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.

采纳的回答

KSSV
KSSV 2016-4-12
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by