-
-
Notifications
You must be signed in to change notification settings - Fork 296
Home
Welcome to the Pluto.jl FAQ!
How is Pluto.jl different from Jupyter?
Pluto.jl was built from the ground up to be a fresh new notebook system, written in Julia. The main differences are that Pluto noteboks are reactive, and that your notebooks are stored as executable
.jl
files.
What's the deal with reactivity?
You use cells to define variables and functions to be used later. In a reactive notebook, changing a variable or function will automagically re-evaluate all other cells that use it. Just like a speadsheet editor! See this gif for a demo.
Programming is hard sometimes. Even more so when you need to keep track not only of your code, but also of your session's hidden state. Pluto gives you confidence that the code you see exactly matches the variables you're working with, eliminating bugs before you even knew you had them.
Will all cells be re-evaluated when I change something?
No. Pluto.jl figures out the dependency graph between cells, and knows exactly which cells to re-evaluate, in which order. A cell never executes twice.
Will my code be slower?
Nope - Pluto.jl analyses your code, and then executes the code without modifications. Variables and functions are not wrapped in special objects. After analysis, your code will run on its own.
Can I use Plots
!
Yes you can! All plotting back-ends should work right away.
Can I use [my favourite package]
?
Yes you can! (Probably!) Your code is evaluated as-is, so if it works in the REPL or in Jupyter, it will work in Pluto.jl. The only exceptions are packages that are made specifically for the REPL or Jupyter.
Calls to external functions are not tracked by the reactivity fairies.
How do I save my notebook?
Your notebook is auto-saved every time that you run a cell. Keep in mind that changes to a cell's code are not saved until you run that cell.
Can I open multiple notebooks at the same time?
Yes! Click on the Pluto.jl logo to go back to the welcome screen. You can use your browser tabs to see multiple notebooks simultaneously.
What are the keyboard shortcuts?
Ctrl+Enter
- run cell
Shift+Enter
- run cell and add cell below
Ctrl+Shift+Delete
- delete cell
Tab
- show autocomplete
Ctrl+Shift+?
- show keyboard shortcuts
How can I export to PDF?
You can use your browser's print function to generate a PDF (
Ctrl+P
). Pluto will hide all UI elements in print mode.
How can I export to a Julia script?
Your notebook file is a Julia script. The funky looking comments inside the file are used by Pluto to know which code belongs to which cell, and how cells should be ordered. Notebooks are autosaved.
How do I make my variables reactive?
All global variables are automatically reactive!
How do I write multiple expressions in one cell?
You can use a
let ... end
block or abegin ... end
block to wrap multiple expressions into one.
I used print
and display
but nothing is happening! Help!
These functions will still write to the console where you started Pluto. To display things in Pluto.jl, you simply output the value you want to show.
For example, instead of
begin
x = 25.0
display(sqrt(x))
end
begin
y = 0.1
display(cos(x))
display(sin(x))
end
you can write
begin
x = 0.1
sqrt(x)
end
begin
x = 0.1
cos(x), sin(x)
end
In Julia, the last subexpression in a block (
begin
,let
,if
, etc.) is the output value.
How can I modify a variable in a different cell?
Variables can only be assigned and modified in a single cell. This is what makes reactivity possible:
For example, if you have four cells:
"I have $(n) pets"
,n += 3
,n *= 2
andn = 0
, what is supposed to happen?Try to write all assignments in one cell, using a
begin ... end
or alet ... end
block, or try renaming you variables. The example above would become:
"I have $(n_today) pets"
begin
n_today = n_yesterday
n_today += 3
n_today *= 2
end
n_yesterday = 0
That doesn't work for me!
Sometimes a mutable state makes the most sense for your problem.
In Pluto, assignments to values (e.g.
a = 1
) will 'trigger' reactivity, but assignments to properties (e.g.a.start = 2
ora[5] = 3
) will not. This means that you can use aRef
(docs) to create 'non-reactive' variables.
How can I write different methods/specialisations for a function?
You need to put all definitions in one cell, using a
begin ... end
block.
If you see something strange or if you have trouble using Pluto, let us know by opening a Github Issue. With your help, we can make Pluto work for everyone π
If you want to quickly share your thoughts, use the quick and easy feedback form on the bottom of your Pluto notebook. You have the option to leave your email address, or to do this anonymously.