Remove Dashed Grey Asymptote Lines From Plot

10 visualizzazioni (ultimi 30 giorni)
I have a plot of a few symbolic functions in matlab, and I'm getting some grey dashed lines. I'm going to guess that these are for asymptotes, which I expected. Is there a way to remove these lines?
Attached is my plot. The lines I'm talking about are at x = 4 and x = 0. Ignore the legend and other colors, that's another story.
  3 Commenti
Benjamin Blood
Benjamin Blood il 12 Set 2020
I used fplot. I guess you're right, it's a discontinuity. Do you know if there's a way to remove it?
mauricio
mauricio il 19 Set 2022
is there a way to change their color?

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 12 Set 2020
If you let
h = fplot(expression, range)
then
h.NodeChildren(1).Visible = 'off';
will turn off the discontinuinity lines. (The gray dashed ones, at least. At the moment I do not recall the formula for any functions that generate the brown discontinuity lines. Possibly NodeChildren(2) for those.)
  5 Commenti
Walter Roberson
Walter Roberson il 18 Set 2020
Put a drawnow() before setting the Visible to off. If you set the visible to off before the drawnow then it will be reset to on when the plot renders.
... No, I do not know why this happens. I could make some guesses.
Oh, look at that, the line comes back again if you resize the plot. I think we can deduce that the rendering callbacks are turning the visibility on. You might want to add in a ResizeFcn callback to drawnow() and turn it invisible again after the axes changes. Or perhaps a PostSet listener on the axes Position property.
Benjamin Blood
Benjamin Blood il 19 Set 2020
Running drawnow works. Right now I'm just running those commands in the command window every time I resize the plot, but that works for now. Thank you for your help!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by