f



'YScale','log',

I would like to convert a graph from linear y-axis, to a
logarithmic y-axis. However, once that is done, one of the
vertical lines (which I use to indicate the required point)
disappears. See the image below:

http://img517.imageshack.us/img517/4937/weirdak0.jpg



My plotting code:

figure1 = figure('Color',[0.8 0.8 0.8]);
axes('Parent',figure1,'YScale','log','YMinorTick','on','YMinorGrid','on',...
    'FontSize',8,...
    'FontName','Verdana');
xlim([1 2.2]);
ylim([0 1000]);
box('on');
grid('on');
hold('all');



plot([0, k_Re], [Re_i, Re_i],'LineStyle','--','Color',[1 0 0]);
plot([k_Re,k_Re], [0, Re_i],'LineStyle','--','Color',[1 0 0]);
plot(x_Re,y_Re,'LineWidth',2,'Color',[0 0 1]);

% where k_Re = 2.081410
%       Re_i = 200


xlabel('Correction factor
[k_R_e]','FontWeight','light','FontSize',8,'FontName','Verdana');
ylabel('Reynolds number
[Re]','FontSize',8,'FontName','Verdana');
title({'An empirical correction factor';'as a function of
fuselage Reynolds
number'},'FontWeight','bold','FontSize',8,'FontName','Verdana');




Any reason why this is happening?
0
6/15/2008 4:46:02 PM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

4 Replies
709 Views

Similar Articles

[PageSpeed] 40

Gjergji wrote:
> I would like to convert a graph from linear y-axis, to a
> logarithmic y-axis. However, once that is done, one of the
> vertical lines (which I use to indicate the required point)
> disappears. ...
....
> figure1 = figure('Color',[0.8 0.8 0.8]);
> axes('Parent',figure1,'YScale','log','YMinorTick','on','YMinorGrid','on',...
....
> plot([0, k_Re], [Re_i, Re_i],'LineStyle','--','Color',[1 0 0]);
> plot([k_Re,k_Re], [0, Re_i],'LineStyle','--','Color',[1 0 0]);
> plot(x_Re,y_Re,'LineWidth',2,'Color',[0 0 1]);
....
> Any reason why this is happening?

Undoubtedly... :)  (But I don't know why, otomh)

My question/suggestion would be why did you not use semilogy()?

--

0
none1568 (7453)
6/15/2008 5:44:48 PM
Log plots can be tricky.

In your second call to plot, you try to plot a vertical line
from y = 0 to y = Re_i,  but log10(0) = -Inf, so the line
ends up being a point at (k_Re,Re_i).

Try plotting from 1 instead.

0
spamanon (2437)
6/15/2008 5:55:04 PM
This reproduces your log plot pretty closely.




Re_i = 200;
k_Re = 2.081410;
x_Re = 1.15:.1:2.15;
y_Re = (140.^(x_Re))*.00657;
figure1 = figure('Color',[0.8 0.8 0.8]);
axes('Parent',figure1,'YScale','log','YMinorTick','on','YMinorGrid',...
     'on','FontSize',8,'FontName','Verdana');
xlim([1 2.2]);
ylim([0 1000]);
box('on');
grid('on');
hold('all');
plot([0, k_Re], [Re_i, Re_i],'LineStyle','--',...
     'Color',[1 0 0]);
plot([k_Re,k_Re], [min(y_Re),
Re_i],'LineStyle','--','Color',[1 0 0]);
plot(x_Re,y_Re,'LineWidth',2,'Color',[0 0 1]);
xlabel('Correction factor [k_R_e]','FontWeight',...
       'light','FontSize',8,'FontName','Verdana');
ylabel('Reynolds number
[Re]','FontSize',8,'FontName','Verdana');
title({'An empirical correction factor';...
       'as a function offuselage Reynoldsnumber'},...
     'FontWeight','bold','FontSize',8,'FontName','Verdana');

0
spamanon (2437)
6/15/2008 7:06:02 PM
Nicely done...
Yeah that totally slipped my mind. Taking the minimum of
y_Re works great.

Thanks a lot. I appreciate it.
0
6/15/2008 7:48:03 PM
Reply: