Scatter plot with strings on x axis
显示 更早的评论
I want to plot a scatter plot with sampling sites on x axis like S1, s2 names and on y axis I want to plot concentration of various metals. Also I want to divide the plot into sections as in the figure. If I am using xline command then it is plotting a line on the sampling sites but I want the dividing line to be between s2and S3.for example here in the picture the dividing line is between j5 and ju1 Can anyone help?

采纳的回答
更多回答(1 个)
dpb
2022-5-23
0 个投票
<scatter> can take a categorical variable as an x variable in which case you can get the text labels automagically -- however, the x-axis then will be categorical and have only integral values of those categories that can be plotted on it.
Your options are to either use a numeric category number for x and the set the tick labels as wanted with <xticklabels> which lets you write any string desired at any tick.
You can then draw the vertical lines at any x value you wish between the integral tick values.
类别
在 帮助中心 和 File Exchange 中查找有关 Scatter Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
