How to remove an unwanted horizontal line at a specific domain on the x-axis?

12 visualizzazioni (ultimi 30 giorni)
Hi,
I'm having a problem with an unwanted horizontal line appearing in my plot when plotting some of my data (see figure). According to my data, this non-zero line should only appear in the domain where the diameter has no non-zero values for the intensity, and not in the domain where there are non-zero values for the intensity (from ~50-350 nm).
I have attached my code and data. Could anyone help me with finding the reason for this unwanted horizontal line in this domain?
Many thanks in advance!

Risposta accettata

Walter Roberson
Walter Roberson il 28 Lug 2021
Modificato: Walter Roberson il 28 Lug 2021
Your size variable is not in sorted order, but you are using it as the independent variable for the plot, so MATLAB has to draw a line back from the right to the left.
Either insert a non-finite value into the vector at the point it jumps backwards, or else sort your values (and sort the other variable in the same order). Or switch to drawing points only instead of lines.

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by