Borrar filtros
Borrar filtros

How to get different scales on the same axis?

3 visualizaciones (últimos 30 días)
Barthelemy Kinoo
Barthelemy Kinoo el 9 de Jun. de 2015
Editada: Ingrid el 9 de Jun. de 2015
I would like to have two scales on the same x-axis. I want the scale to be 100 from 0 to 1000 (i.e. 0,100,200,...,1000). And then I want the scale to be 1000 from 1000 to 20,000 (i.e. 1000,2000,...20,000). Note: the client does not want a semi-logarithmic scale (looks to complicated for him ;) ). Does someone have any ideas?

Respuestas (2)

Radha Krishna Maddukuri
Radha Krishna Maddukuri el 9 de Jun. de 2015
This can be done by modifying the XTick property of the axis. Try the following. A similar approach can be used for your usecase.
x = linspace(0,20,1);
y = cos(x);
plot(x,y)
x = linspace(0,20,100);
y = cos(x);
plot(x,y)
ax = gca
ax.XTick = [0:1:5 6:2:20]

Ingrid
Ingrid el 9 de Jun. de 2015
Editada: Ingrid el 9 de Jun. de 2015
just use
set(gca,'xTick',[0:100:1000,2000:1000:20000]);

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by