- Julia - Discussion
- Julia - Useful Resources
- Julia - Quick Guide
- Julia - Databases
- Julia - Networking
- Working with Graphics
- Julia - Modules and Packages
- Working with Datasets
- Julia - Data Frames
- Julia - Plotting
- Julia - Metaprogramming
- Julia - Files I/O
- Julia - Date & Time
- Julia - Dictionaries & Sets
- Julia - Flow Control
- Julia - Functions
- Julia - Strings
- Basic Mathematical Functions
- Julia - Basic Operators
- Julia - Rational & Complex Numbers
- Integers & Floating-Point Numbers
- Julia - Tuples
- Julia - Arrays
- Julia - Basic Syntax
- Julia - Environment Setup
- Julia - Overview
- Julia - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Jupa Programming - Plotting
Jupa has various packages for plotting and before starting making plots, we need to first download and install some of them as follows −
(@v1.5) pkg> add Plots PyPlot GR UnicodePlots
The package Plots is a high-level plotting package, also referred to as ‘back-ends’ interfaces with other plotting packages. To start using the Plots package, type the following command −
jupa> using Plots [ Info: Precompipng Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
Plotting a function
For plotting a function, we need to switch back to PyPlot back-end as follows −
jupa> pyplot() Plots.PyPlotBackend()
Here we will be plotting the equation of Time graph which can be modeled by the following function −
jupa> eq(d) = -7.65 * sind(d) + 9.87 * sind(2d + 206); jupa> plot(eq, 1:365) sys:1: MatplotpbDeprecationWarning: Passing the fontdict parameter of _set_ticklabels() positionally is deprecated since Matplotpb 3.3; the parameter will become keyword-only two minor releases later. sys:1: UserWarning: FixedFormatter should only be used together with FixedLocator
Packages
Everyone wants a package that helps them to draw quick plots by text rather than graphics.
UnicodePlots
Jupa provides one such package called UnicodePlots which can produce the following −
scatter plots
pne plots
bar plots
staircase plots
histograms
sparsity patterns
density plots
We can add it to our Jupa installation by the following command −
(@v1.5) pkg> add UnicodePlots
Once added, we can use this to plot a graph as follows:
jupa> using UnicodePlots
Example
Following Jupa example generates a pne chart using UnicodePlots.
jupa> FirstLinePlot = pneplot([1, 2, 3, 7], [1, 2, -5, 7], title="First Line Plot", border=:dotted) First Line Plot
Example
Following Jupa example generates a density chart using UnicodePlots.
Jupa> using UnicodePlots Jupa> FirstDensityPlot = densityplot(collect(1:100), randn(100), border=:dotted)
VegaLite
This Jupa package is a visuapzation grammar which allows us to create visuapzation in a web browser window. With this package, we can −
describe data visuapzation in a JSON format
generate interactive views using HTML5 Canvas or SVG
It can produce the following −
Area plots
Bar plots/Histograms
Line plots
Scatter plots
Pie/Donut charts
Waterfall charts
Worldclouds
We can add it to our Jupa installation by following command −
(@v1.5) pkg> add VegaLite
Once added we can use this to plot a graph as follows −
jupa> using VegaLite
Example
Following Jupa example generates a Pie chart using VegaLite.
jupa> X = ["Monday", "Tuesday", "Wednesday", "Thrusday", "Friday","Saturday","Sunday"]; jupa> Y = [11, 11, 15, 13, 12, 13, 10] 7-element Array{Int64,1}: 11 11 15 13 12 13 10 jupa> P = pie(X,Y)Advertisements