Graphics in Julia
Several packages exist to plot data and visualize data relations; Plots
and PyPlot
are some of the most commonly used:
PyPlot
: (refer to the Installing and working with Jupyter section in Chapter 1, Installing the Julia Platform) This package works with no overhead through thePyCall
package. The following is a summary of the main commands:plot(y)
,plot(x,y)
plots y versus 0,1,2,3 or versusx:loglog(x,y)
semilogx(x,y)
,semilogy(x,y)
for log scale plotstitle("A title")
,xlabel("x-axis")
, andylabel("foo")
to set labelslegend(["curve 1", "curve 2"], "northwest")
to write a legend at the upper-leftgrid()
,axis( "equal")
adds grid lines, and uses equalx
andy
scalingtitle(L"the curve $e^\sqrt{x}$")
sets the title with a LaTeX equationsavefig( "fig.png")
,savefig( "fig.eps")
saves as the PNG or EPS image
Plots
: (refer to the Adding a new package section in Chapter 1, Installing the Julia Platform) This is the favorite package in the Julia Computing community. It is a visualization interface...