scatter plot in matlab

조회 수: 13 (최근 30일)
rohit
rohit 2023년 12월 27일
댓글: Dyuman Joshi 2023년 12월 27일
I have a dataset containing two columns of data, x and y, and I want to create a scatter plot of these points in MATLAB. Additionally, I want to customize the plot by setting the marker style to circles, the marker color to red, and adding a title "Scatter Plot of x vs y" to the graph. I need matlab code accomplish this.
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2023년 12월 27일
이동: Dyuman Joshi 2023년 12월 27일
See the documentation of scatter. You will find all the information you need in there.
Torsten
Torsten 2023년 12월 27일
If your homework gets too tough, I suggest to invest 2 hours of your time and visit the MATLAB introductory course free of costs under

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

채택된 답변

Hari
Hari 2023년 12월 27일
Hi Rohit,
I understand that you need assistance with creating a scatter plot in MATLAB using a dataset with two columns, 'x' and 'y'. You want the plot to have a specific marker style and color, and to include a custom title.
I am assuming that the data is stored in two vectors "x" and "y" of equal length, here is the MATLAB code that would create the desired scatter plot:
% Assuming x and y are your dataset columns
scatter(x, y, 'o', 'MarkerEdgeColor', 'r'); % 'o' sets the marker to circles, 'r' sets the color to red
title('Scatter Plot of x vs y'); % Adds the title to the plot
This code uses the "scatter" function to create the scatter plot, sets the marker style to circles with "o", and the marker edge color to red with "MarkerEdgeColor", "r". The "title" function is then used to add the specified title to the plot.
Refer to the documentation of "scatter" function for more information on how to create scatter plots and customize markers.
Hope this helps!
  댓글 수: 4
Torsten
Torsten 2023년 12월 27일
편집: Torsten 2023년 12월 27일
I think nobody has such a clear idea concerning marker, markerstyle and title if it's not a homework question. Even the exact names marker, markerstyle and title wouldn't come to his/her mind because it implies that he/she knows the "scatter" command.
Dyuman Joshi
Dyuman Joshi 2023년 12월 27일
I agree with @Torsten.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by