scatter plot in matlab

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.
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

请先登录,再进行评论。

 采纳的回答

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 个评论

@Hari, Please don't do obvious homework questions on Answers, when no effort has been shown. Especially when it is such basic thing like what OP has asked.
This does not help the student, who learns nothing more than to post all of their homwork problems on the site, hoping they will find someone willing to do their thinking and work for them. Worse that that, it convinces the next student who comes along to do the same.
If you want to help, then find a way to push the student in the right direction. But posting a complete solution does far more harm than good.
Image Analyst
Image Analyst 2023-12-27
编辑:Image Analyst 2023-12-27
To be fair I see nothing that explicitly says it's a homework question. It could be a legitimate request of someone on how to plot their experimental data in a certain desired way. What's more obvious is that this answer is a AI chatbot answer and it should have been mentioned that it was.
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.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Axis Labels 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by