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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!