MATLAB Answers

## scatter plot with non-linear axis

Asked by Birgit

### Birgit (view profile)

on 17 Nov 2012
Accepted Answer by Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

Hi together!

I have been trying for a while now to make a certain graph, but just do not succeed :-(

Here is what I need:

A scatter plot, where the y axis is linear scaled: y = [0.7, 0.9] and the x-axis is non-linear scaled: x = [1/128, 1/64, 1/32, 1/16, 1/8, 1/4, 1/2, 1, 2]

Could anybody PLEASE help me??

## 1 Answer

### Azzi Abdelmalek (view profile)

Answer by Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

on 17 Nov 2012
Accepted answer

```x=1:10
y=sin(x)
x1=1./2.^(-1:length(x)-2),
scatter(x1,y)
```

Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

on 17 Nov 2012

try this

```close
x=1:10
y=sin(x)
x1=1./2.^(-1:length(x)-2),
scatter(x,y)
set(gca,'xticklabel',fliplr(x1))
grid
```
Walter Roberson

### Walter Roberson (view profile)

on 17 Nov 2012
```set(gca, 'XScale', 'log')
```

This will give you log 10, but log 2 is a linear multiple of log 10.

Birgit

### Birgit (view profile)

on 17 Nov 2012

thanks to both of you! :-) it's great to get help here!

#### Join the 15-year community celebration.

Play games and win prizes!

Learn more

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

### MATLAB Academy

New to MATLAB?

Learn MATLAB today!