change the scale on graph

417 Ansichten (letzte 30 Tage)
Jamie Shelley
Jamie Shelley am 18 Apr. 2016
Bearbeitet: Veronica Lucchese am 27 Feb. 2019
I've been researching this a while and can't find what I need - I can change the limits on the axis for graphs etc without a problem, but what I need is to change the numbers on the scale, without actually changing the scale of the graph (not sure if I'm explaining right). So I have a pcolor plot, but wish to change the numbers on the axes, without changing the axes limits (So I still want to show the same data, but with the axes reading different values) - for example, the current values multiplied by a constant. Thanks
  1 Kommentar
Veronica Lucchese
Veronica Lucchese am 27 Feb. 2019
Bearbeitet: Veronica Lucchese am 27 Feb. 2019
In matlab, the scale is called the c-axis. In order to manipulate the scale, you must manipulate the c-axis values
type in the command window:
caxis([0 0.1]) or whatever you want you scale limits to be

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 18 Apr. 2016
Bearbeitet: Azzi Abdelmalek am 18 Apr. 2016
You mean to change the ticks of your axis. For example
x=0:10
y=cos(x)
plot(x,y)
number_of_ticks=5
xt=xlim
set(gca,'xtick',linspace(xt(1),xt(2),number_of_ticks))
  10 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 18 Apr. 2016
This works for me
Jamie Shelley
Jamie Shelley am 18 Apr. 2016
I don't understand why it still won't work for me, I can't see what's wrong with it

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Kelly Kearney
Kelly Kearney am 18 Apr. 2016
You can simply change the YTickLabel property:
ax = axes;
plot(1:10)
ax.YTickLabel = strtrim(cellstr(num2str(2 * ax.YTick')))
  1 Kommentar
Jamie Shelley
Jamie Shelley am 18 Apr. 2016
Thanks, but that didn't work, it just deleted the plot from the figure

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by