Book Image

Julia 1.0 Programming - Second Edition

By : Ivo Balbaert
Book Image

Julia 1.0 Programming - Second Edition

By: Ivo Balbaert

Overview of this book

The release of Julia 1.0 is now ready to change the technical world by combining the high productivity and ease of use of Python and R with the lightning-fast speed of C++. Julia 1.0 programming gives you a head start in tackling your numerical and data problems. You will begin by learning how to set up a running Julia platform, before exploring its various built-in types. With the help of practical examples, this book walks you through two important collection types: arrays and matrices. In addition to this, you will be taken through how type conversions and promotions work. In the course of the book, you will be introduced to the homo-iconicity and metaprogramming concepts in Julia. You will understand how Julia provides different ways to interact with an operating system, as well as other languages, and then you'll discover what macros are. Once you have grasped the basics, you’ll study what makes Julia suitable for numerical and scientific computing, and learn about the features provided by Julia. By the end of this book, you will also have learned how to run external programs. This book covers all you need to know about Julia in order to leverage its high speed and efficiency for your applications.
Table of Contents (17 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

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 the PyCall package. The following is a summary of the main commands:
    • plot(y), plot(x,y) plots y versus 0,1,2,3 or versus x:loglog(x,y)
    • semilogx(x,y),semilogy(x,y)for log scale plots
    • title("A title"),xlabel("x-axis"), andylabel("foo")to set labels
    • legend(["curve 1", "curve 2"], "northwest")to write a legend at the upper-left
    • grid(),axis( "equal")adds grid lines, and uses equalxandyscaling
    • title(L"the curve $e^\sqrt{x}$")sets the title with a LaTeX equation
    • savefig( "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...