Semilogx plot does not plot part of my data

Hi,
I'm trying to plot calculated thicknesses of sedimentology flume experiments in a 2D plot with transported distance (x) and thickness (y).
The plot contains multiple lines (one for each grainsizeclass) and are added to the plot using the hold on command.
I want to make the x-axis logaritmic to better visualise the data.
% Plot total lobe geometery as a regular plot
% advplot.sp is an array with sample points.
% LobeThickness.grainsizeclass is the thickness of that grainsizeclass in the y-direction.
F7 = figure('Name','Predicted Lobe Geometry');
plot(advplot.sp,LobeThickness.Total,'g');
hold on
plot(advplot.sp,advplot.Fsilt,'g');
hold on
plot(advplot.sp,advplot.Fvfsd1,'Color','[0.6 1 1]','linewidth',1.5);
hold off
% my code plots up to 17 lines in one figure, I reduced it to 3 for this example
% Plot total lobe geometery as semilogx plot
F8 = figure('Name','Predicted Lobe Geometry');
plot(advplot.sp,LobeThickness.Total,'g');
hold on
plot(advplot.sp,advplot.Fsilt,'g');
hold on
plot(advplot.sp,advplot.Fvfsd1,'Color','[0.6 1 1]','linewidth',1.5);
hold off
set(gca,'FontSize',29','XScale', 'log') % this is the only difference with the plot above
I know from the first plot that the maximum y value should be about 3.3. When making the semilogx plot it seems like part of the data is not plotted, the maximum y value in the plot is now ~ 0.15 m whilst it shouldn't change.
  • I used the same method on other data, here the semilogx plot works fine (max y values are the same for plot (x,y) and semilogx(x,y).
  • I tried adjusting the xlim and ylim values, this does not make a difference
I added a few figures which I think show what goes wrong.
Any help is much appreciated.

5 commentaires

Mathieu NOE
Mathieu NOE le 5 Jan 2021
hello
please remember that a loglog or semilogx plot cannot display the y value associated with x = 0
so if your maximum y value (about 3.3) correspond to x = 0 , it will not be displayed once you use loglog or semilogxg
Hi Mathieu NOE, thanks for the reply.
I checked what the x value for the higher y values should be. The value is at x = 0 but values between 2 and 3 should still show for values between x = 0 and x = 0.025.
I tried:
xlim([10e-3 1.2.*max(AdvLength.vf_sand1(:))]); % setting the xlim min to 10e-3 manually
But this didn't solve the issue (see figure below).
Mathieu NOE
Mathieu NOE le 5 Jan 2021
could you send me the data , please ?
Pelle Adema
Pelle Adema le 5 Jan 2021
As I was preparing the data to send them to you I finally saw what the issue was.
My sample points for the x axes are spaced by 0.05 and interpolated in between the points. As you pointed out the semilogx function cannot work with x is 0. I suppose it can therefore also not interpolate between log 0.05 and log 0, so these data are left out. I get the result that I need by changing the stepsize of my sample points array.
Thanks for helping out, definitely pointed me in the right direction.
Mathieu NOE
Mathieu NOE le 5 Jan 2021
glad you find it !

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Produits

Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by