How to change the form and color of the asymptote?

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

In the above code, why is this segment of code unable to change the style and color of the automatically generated asymptotes? How can we set and modify the style and color of the asymptotes?

ExclusionsStyle -> Directive[Dashed, AbsoluteThickness[0.5], Red]

Unfortunately, I don’t know how to produce what you want, but I can tell you that the problem is due to setting Filling. If you can do without Filling then you’ll get your asymptote. If you need the filling, then you might need to create your own composite plot.

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".

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?

The asymptote is not displayed in red.

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]

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]]

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