i want to make scatter but like this, how can i do this???
i want that graph is have two y axis and two x axis with same scale
in the picture I edited it using pain to add line on the top and right of the graph
i want to do this with matlab
thanks before and sorry for my bad english

댓글 수: 8

dpb
dpb 2021년 7월 24일
You don't need two axes for that, just hold on
hold on
hSc(1)=scatter(xMeas,yMeas);
hSc(2)=scatter(xMeas,yMeas);
hL=plot([0 10],[0 10],'k-');
with the other parameters of color, marker style, etc., etc., ... as you wish.
Agnes Diza Fahira
Agnes Diza Fahira 2021년 7월 24일
편집: Agnes Diza Fahira 2021년 7월 24일
I've used
hold on
but still not getting a line on the top and right of the graph
I want to make a graph like the left one not the right one
dpb
dpb 2021년 7월 24일
box on
Agnes Diza Fahira
Agnes Diza Fahira 2021년 7월 24일
it works, thankyouu~
Image Analyst
Image Analyst 2021년 7월 24일
@dpb, again, put it as an official Answer so it can easily be seen and Anges can "thank" you by Accepting your answer and giving you reputation points (which has some benefits you may not be aware of).
dpb
dpb 2021년 7월 24일
편집: dpb 2021년 7월 24일
What other benefits are associated with more reputation points after MVP status, IA? Besides the commemorative marker TMW sends annually, anyways... :)
I've really never paid much attention -- I followed the old cssm newsgroup and was reluctant to move over when TMW went to the forum instead...but it is my entertainment after retirement from the consulting gig so I'm still hanging around...I told myself then I'd suffer through enough to get to the 40-pt mark before I gave it up. I guess I kept that one, anyways.
Image Analyst
Image Analyst 2021년 7월 24일
Well, I probably shouldn't say. Just trust me on this. You'll find out eventually when you get enough points. Thanks for moving though.
dpb
dpb 2021년 7월 24일
Well, I'll never get to your or Walter's stratospheric levels, so I'll not be holding my breath... :) But, I can't complain re: my treatment from TMW to date, in fact, I'm very grateful.
And being at point that "I no longer buy green bananas" is beginning to not be so far off, odds aren't necessarily in my favor... :)

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

 채택된 답변

dpb
dpb 2021년 7월 24일

0 개 추천

Per IA's direction...with a correction for the data variables--dpb :)
You don't need two axes for that, just hold on
hold on
hSc(1)=scatter(xTrain,yTrain);
hSc(2)=scatter(xTest,yTest);
hL=plot([0 10],[0 10],'k-');
box on
legend(hSc,'Training','Testing')
with the other parameters of color, marker style, etc., etc., ... as you wish.

추가 답변 (1개)

KSSV
KSSV 2021년 7월 24일

1 개 추천

  1. Fit striaght line to the given data using polyfit.
  2. Plot the line using plot function.
  3. Use hold on
  4. Plot the given data using scatter.
  5. To put a legend use legend.
Also have a look on the function plotregression.

댓글 수: 1

dpb
dpb 2021년 7월 24일
NB:
Re: 1. above, the line isn't the OLS fit of the data but the 1:1 45 of the input:output that would be the perfect correlation.

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2021년 7월 24일

댓글:

dpb
2021년 7월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by