How to increase point density in julia plots?

Viewed 71

I'm plotting the function tan but it's not rendered cleanly because the point density is too low around Inf values.

using Plots
plot(x -> tan(x), 1, 10)

tan function

How can I increase point density ? I don't see it in the documentation.

2 Answers

I found the syntax : plot(x -> tan(x), 1:0.0001:10, ylims=(-20, 20)) with this the x axis goes from 1 to 10 with a step of 0.0001

The simplest way is just to explicitly specify a vector of x points:

using Plots
x = 0:0.001:10
plot(x, tan.(x), xlims=(0,10), ylims=(-1000,1000))

tan(x) from 0 to 10

Related