1
$\begingroup$

I have the following code of an iteration:

T[x_] := T[x] = (x/2)
x[0] = 7.9;
x[n_] := x[n] = T[x[n - 1]]
NumberForm[a1 = {Table[{x[i], x[i + 1]}, {i, 0, 9}]}, 9]
plot1 = ListPlot[a1, Joined -> True, PlotStyle -> {Red, Dashing[0.1]}]

When I run the above code, I have a straight-line graph with no dashes. When I remove Red from the PlotStyle, I get a dashed graph with different color, but I need a dashed graph with red coloring.

$\endgroup$

1 Answer 1

2
$\begingroup$

You need to use "Directive[Red,Dashing[0.05]]:

plot1 = ListPlot[a1, Joined -> True, 
  PlotStyle -> {Directive[Red, Dashing[0.05]]}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks @Daniel Huber, I got what I need. Thanks again for your help. $\endgroup$ Sep 15, 2023 at 19:20
  • 3
    $\begingroup$ @JunaidAhmad - Alternatively, you could use PlotStyle -> {{Red, Dashing[0.1]}} $\endgroup$
    – Bob Hanlon
    Sep 15, 2023 at 21:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.