【问题标题】:semilog plots with hold on暂停的半对数图
【发布时间】:2012-02-28 07:51:31
【问题描述】:

如果我尝试使用对数轴绘制多个图,则会禁用对数刻度。如果我删除hold on,则启用对数刻度,但我只能绘制一个图。

figure(1); clf
x = linspace(0,1,100);
y = exp(-x);

hold on;
semilogy(x, y);
semilogy(x, 2*y);
hold off;

为什么?,如何创建多个对数比例图?

【问题讨论】:

  • 是的,虽然我的这段代码比我的例子更混乱而且结构更少......

标签: matlab plot logarithm


【解决方案1】:

您的代码已经在 octave 中工作(而且我在这台计算机上没有 matlab),但我认为问题是您在第一个绘图之前执行 hold on,因此无法创建初始轴。试试这个:

figure(1); clf
x = linspace(0,1,100);
y = exp(-x);

semilogy(x, y);
hold on;
semilogy(x, 2*y);
hold off;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多