After adding a command to get dotted line graph I am still getting solid line only in the legend i am getting dotted line

조회 수: 1 (최근 30일)
plot(x1 - x2,F,':g');
xlabel('Displacement(m)')
ylabel('Spring Force(N)')
legend('F')

답변 (1개)

Image Analyst
Image Analyst 2024년 5월 25일
Most likely you have so many points that the dotted line between them is super short, like a pixel. What if you plot just a few of your points? Also green is very hard to see against a white background. Try a darker color. As you can see below, with only 10 points you can see the dotted line.
% Create sample data
numPoints = 10;
x1 = 10 * sort(rand(1, numPoints));
x2 = sort(rand(1, numPoints));
F = rand(1, numPoints);
% Plot data
plot(x1 - x2,F,'g:.', 'MarkerSize', 22);
xlabel('Displacement(m)')
ylabel('Spring Force(N)')
legend('F')
  댓글 수: 3
Puja
Puja 2024년 5월 25일
Also can you tell me how to get a graph like this in matlab which has completely white background.
Image Analyst
Image Analyst 2024년 5월 26일
You forgot to tell me how many points you were plotting. AND you forgot to attach your data so what else can I do?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by