MATLAB: How to use text as tick marks in x-axis in a plot plotscatter I am generating a graph where I want to specify some tick on x-axis with text. Please find attached the figure of what I want to do. Best Answer Here is one way:% Some pretend dataN = 10;x = sort(2*rand(N,1));y = sort(2*rand(N,1));% Plot the figurefigureplot(x,y)% Define the tick locations, and label themset(gca,'XTick',0.5:0.5:2)set(gca,'XTickLabel',{'\beta=0.5','\beta=1.0','\beta=1.5','\beta=2.0'})That is pretty manual. If you need it to be more automatic, you'll need to get the values of the x-ticks, and then use that vector of values to create the labels. Related SolutionsMATLAB: Deletting X and Y axes ticks set(gca,'xtick',[]) set(gca,'ytick',[]) MATLAB: Adding tick marks without overriding existing marks Play around with this:>> x = 5.7;>> yV = get(gca,'ylim');>> text(x,yV(1),num2str(x),'VerticalAlignment','top','HorizontalAlignment','center')>> line([x,x],yV) Related QuestionSpectrogram x axis logarithmicAdding and customisng a single tick markI need to reverse the X axis in a stacked plot graph. How to do thatManipulating X-Axis Values
Best Answer