CrypticParadigm
CrypticParadigm

Reputation: 227

Plotting functions in Julia

I am trying to plot a function in Julia, but keep getting errors. I don't understand what is wrong. The input and output of $\varphi$ is a scalar. I've used x=1530:1545 and still get an error-- can anyone enlighten me? I am very confused.

I am using Julia 0.7.enter image description here

EDIT:

I got it to work with a slight modification--I changed x = 1530:1545 added the following two lines

y = t.(x) plot(x,y)

Why did I have to do this though?

Upvotes: 1

Views: 1409

Answers (1)

Lufu
Lufu

Reputation: 466

This feature is currently not available in PyPlots.jl, if you would like to have it in the future, your best bet is to file an issue. However, you can get that functionality via Plots.jl and using PyPlot as a backend. It would look like this (I'll take a simpler function):

using Plots
pyplot()

start_point = 0
end_point = 10
plot_range = start_point:end_point
plot(sqrt,plot_range) # if you want the function exactly at 0,1,2,3...
plot(plot_range,sqrt) # works the same
plot(sqrt,start_point,end_point) # automatically chooses the interior points

Upvotes: 2

Related Questions