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

조회 수: 4 (최근 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