how do I modify the axis in plot(x,y)?
Mostrar comentarios más antiguos
Hi, I need to plot the following vectors: x=[0.05 0.1 0.3 0.5 1 5 10 20 30 40 50] y=[0.8 0.83 0.9 0.93 0.93 0.9 0.9 0.94 0.95 0.95 0.95] plot(x,y)
My problem is that the vector x don't appears explicitly in the axis and also the scale of the axis is not constant. I need something like:
----------------------------------------------------
0.05 0.1 0.3 0.5 1 5 10 200 ...
your help will be very useful for me
Respuesta aceptada
Más respuestas (2)
Matt Fig
el 7 de Mzo. de 2011
Is this more to your liking?
x=[0.05 0.1 0.3 0.5 1 5 10 20 30 40 50];
y=[0.8 0.83 0.9 0.93 0.93 0.9 0.9 0.94 0.95 0.95 0.95];
plot(x,y)
set(gca,'xtick',x);
set(gca,'xticklabel',num2str(x.'));
Now, separately try this and see if it is what you need. When you have such large differences in scale, there can be problems representing all the data points on an axis.
set(gca,'xscale','log') % Set to linear to go back.
1 comentario
claudio
el 7 de Mzo. de 2011
laurent jalabert
el 23 de Mayo de 2019
0 votos
hello, what about a function to modify the xTicks label with a non-linear function of x ?
For example, displaying the grid as x^3 ?
Categorías
Más información sobre Subplots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!