elemental
elemental

Reputation: 103

How to increase point density in julia plots?

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.

Upvotes: 3

Views: 117

Answers (2)

elemental
elemental

Reputation: 103

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

Upvotes: 2

cbk
cbk

Reputation: 4370

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

Upvotes: 0

Related Questions