Allen Jee
Allen Jee

Reputation: 717

How to Equally distribute the data point on the graph along x axis

I have some datas, say from [0.1:0.1:0.9]+[1:1:10].

If I use scatter to plot it, it looks like this.

enter image description here

However, it want the points equally distribute along the axis, anyone can tell me how to do it? What I mean is the distance between data points in [0.1-0.9] are the same with [1-10] on the graph respect to x-axis.

Upvotes: 0

Views: 1567

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112749

If your data is contained in vectors x and y, use

plot(y,'o')

instead of plot(x,y,'o') or scatter(x,y).

If you want to label the x axis, use something like

set(gca,'xtick',1:length(y),'xticklabel',[.1:.1:.9 1:10])

Or you might want a subset of the labels, for example:

set(gca,'xtick',1:2:length(y),'xticklabel',[.1:.2:.9 2:2:10])

Upvotes: 1

Related Questions