From: Jackk on
Hi,

I have some data I would like to plot. It is shear stresses as the function of flow rate. The scale of the data is quite large, x varies from 0.01 to 100 and y varies from 3e-5 to 1.5e-1.

Below I have the code that I wrote but the figure doesn't seem quite right. Could someone help me that I could fit my data properly, thanks in advance.


% flow rates
q = [0.01 0.05 0.1 0.5 1 5 10 50 100];

% shear stresses
shear = [3e-5 1.5e-4 3e-4 1.5e-3 3e-3 1.5e-2 3e-2 1.5e-1 3e-1];

p = semilogy(q,shear) %#ok<NOPTS>
set(gca,'XTickLabel',{'0.01';'0.05';'0.1';'0.5';'1';'5';'10';'50';'100'})
xlabel('flow rate (\mu l / min)')
ylabel('shear stress (Pa)')
set(p,'Color','red','LineWidth',2)
grid on
From: ImageAnalyst on
Jackk:
Simply setting the x (q) tick labels to something (numerical strings
in your case) does not mean that the tick marks are those numbers.
For example the second tick mark is not 0.05 despite you setting the
label to read that - it's at 10 because the x axis is linearly scaled
between 0 and 100 and it chose 10 divisions - 0, 10, 20, 30, .... up
to 100. The tick mark label is merely some character string, NOT a
number and does NOT force the tick mark value to be that character
string (number in your case). The second tick mark is still 10 - it's
not 0.05 despite you writing 0.05 underneath it.

Comment out that set(gca...) line and you'll see.
Replace the two lines with what I have here and you'll understand:

p = semilogy(q,shear, '-rs'); % Plot with markers to show data point
location.
% set(gca,'XTickLabel',
{'0.01';'0.05';'0.1';'0.5';'1';'5';'10';'50';'100'}); % Commented out