在Octave中更改绘图缩放

时间:2015-11-20 04:57:08

标签: plot octave

我正在尝试使用以下Octave代码生成2D绘图:

x_axis = [0, 2000, 4000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000, 22000, 24000, 26000, 28000, 30000, 32000, 34000, 36000, 38000, 40000, 42000, 44000, 46000, 48000, 50000, 55000];
y_axis = [0.0, 1.1362139943230667, 3.011725480219328, 4.545131757387976, 5.645494339268811, 6.341632245863471, 7.55485783191341, 9.698082845719652, 9.81715090204222, 8.629366029821481, 7.01446673437068, 5.947197763974984, 5.318901760924856, 4.383110951158656, 3.829896079165435, 3.1783656030517826, 2.547173908996705, 2.0871037643293615, 1.6803970681818023, 1.3409807153873572, 1.0809200851333154, 0.8306496482769604, 0.7009640582695764, 0.565624976300148, 0.4724802489742704, 0.30894265221854744, 2.333168554726147];

plot(x_axis, y_axis, '-o');
axis([0 55000 0 12], "tic[xy]");

set(gca, 'xtick', 0:52000:2000)
set(gca, 'xticklabel', {'0', '2000', '4000', '6000', '8000', '10000', '12000', '14000', '16000', '18000', '20000', '22000', '24000', '26000', '28000', '30000', '32000', '34000', '36000', '38000', '40000', '42000', '44000', '46000', '48000', '50000', '55000'})

我的y轴按照我想要的方式缩放,但我希望x轴上的刻度对应于我正在绘制的每个x值。当我真的希望x轴比y轴更长时,Octave似乎迫使图形具有方形纵横比。我如何强制Octave这样做?谢谢!

1 个答案:

答案 0 :(得分:0)

我猜你可以试试pbaspect,它允许你在显示x轴,y轴和z轴时设置比例。例如,如果您希望x轴在2D绘图上是y轴的两倍,则应编写pbaspect([2 1 1])

它适用于MATLAB,我相信它也适用于GNU Octave。

希望这有帮助。