Group Abstract Group Abstract

Message Boards Message Boards

0
|
737 Views
|
7 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to change the form and color of the asymptote?

Posted 4 months ago
POSTED BY: Wen Dao
7 Replies

Here are three workarounds:

f[x_] := 1 - 1/(x - 9/2)
Show[Plot[f[x], {x, 0, 10}, Filling -> Axis, PlotStyle -> None,
  Ticks -> {Range[20], Automatic}, AxesOrigin -> {0, 0}],
 Plot[f[x], {x, 0, 10},
  ExclusionsStyle -> Directive[Dashed, AbsoluteThickness[0.5], Red], 
  Exclusions -> "Singularities"]]
Plot[f[x], {x, 0, 10}, Filling -> Axis, ExclusionsStyle -> None, 
 Exclusions -> "Singularities", 
 Epilog -> {Dashed, AbsoluteThickness[0.5], Red, 
   Map[InfiniteLine[#, {0, 1}] &, 
    SolveValues[{FunctionDiscontinuities[f[x], x], y == 0}, {x, y}]]}]
Plot[f[x], {x, 0, 10}, Filling -> Axis,
 ExclusionsStyle -> None, Exclusions -> "Singularities", 
 GridLines -> {SolveValues[FunctionDiscontinuities[f[x], x], x], None},
  GridLinesStyle -> Directive[Dashed, AbsoluteThickness[0.5], Red]]
POSTED BY: Gianluca Gorni
Posted 3 months ago

These three methods are excellent and solve the problem perfectly—thank you so much for your help!

POSTED BY: Wen Dao

An explicit Exclusions value changes the appearance of the asymptote:

f[x_] := 1 - 1/(x - 9/2);
Plot[f[x], {x, 0, 10}, Filling -> Axis, 
 Ticks -> {Range[20], Automatic}, AxesOrigin -> {0, 0}, 
 ExclusionsStyle -> Directive[Dashed, AbsoluteThickness[0.5], Red], 
 Exclusions -> 9/2]

Anyway, in this case I would recommend Exclusions -> "Singularities" instead of "Discontinuities".

POSTED BY: Gianluca Gorni
Posted 4 months ago
POSTED BY: Wen Dao

It seems that Filling completely kills the Exclusions:

pl = Plot[Ceiling[x], {x, -5, 5},
  Filling -> Axis,
  ExclusionsStyle -> Red, Exclusions -> Range[-5, 5]]
FreeQ[pl, Red]
POSTED BY: Gianluca Gorni
Posted 4 months ago
POSTED BY: Eric Rimbey
Posted 4 months ago

If you want both the effect of filling and the ability to freely change the style and color of the automatically generated function asymptote, how should the code be set?

POSTED BY: Wen Dao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard