Nextjournal Features

Welcome to this quick introduction to Nextjournal features.

1. Remixing

Remix is currently the fastest way to perfectly reproduce or reuse an analysis. With a single click, you get a copy of the content (narrative + code), data, and computational environment required to run an analysis.

2. Real-time Collaboration

Real-time collaboration allows multiple people to collaborate on a Nextjournal document simultaneously. All collaborators need to do is share the URL of the article.

Changes can occur simultaneously due to our powerful version control architecture.

Editors can monitor who is editing the document by inspecting Avatars in the lower right hand corner of the webpage that indicate who is viewing and editing the article.

type some new stuff

3. Importing

Data, files, figures, and images can be easily imported into a Nextjournal article.

3.1. Data (Amazon S3 / Google Cloud Storage)

OpenNEX-chicago-climate-2080.csv

Using the insert menu, you can add an S3 or Google Cloud Storage bucket to your article.

  • enter the bucket name
  • click 'Access'
  • 'mount' the bucket under the 'Runtime Settings' menu
  • you are now ready to use data from your cloud storage
Access Bucket
Mount the bucket into a runtime's file system via runtime settings.
mxnet-public
Public
ls -lah /mxnet-public

3.2. Files

Files of any type can be imported using the insert menu or can be imported using drag-and-drop.

Files are automatically added to content-addressed-storage and are version controlled after they are imported.

artist_data.csv

3.3. Notebooks (Jupyter / Markdown / RMarkdown)

Notebooks or markdown files can be easily imported by uploading them from your local machine or by referencing a URL where they are hosted.

Try importing a notebook from this gallery of interesting Jupyter Notebooks!

3.4. Docker Images

Docker images can be easily imported using our docker image import widget. To import and convert into a reusable Nextjournal environment:

  • import docker environment
  • add a bash code cell to verify import
  • give the runtime a unique name
  • export the environment by checking the box in the 'Runtime Settings' menu
  • publish the article
  • Your custom environment is now ready for use on Nextjournal!
Bash Official
Download as Docker image from:
Copy
This image was imported from: bash
head -n 2 /etc/os-release

3.5. GitHub Repositories

GitHub repositories can be imported using the import GitHub repository widget that is located in the insert menu.

  • enter the repository name
  • click 'Clone'
  • 'mount' the repository under the 'Runtime Settings' menu
  • You are ready to use files in the repository!

Import GitHub repository

Mount the repository into a runtime's file system via runtime settings.
default: master
ls -lah /demo

4. Working with Code & Data

Here are a few examples of how you can write code in different programming languages in Nextjournal

4.1. Basics

randn(500)

4.2. Accessing Files

Passagiere S-Bahn Hamburg 2009.csv
library(tidyverse)
read_csv2(
Passagiere S-Bahn Hamburg 2009.csv
) %>% group_by(Station) %>% summarize(Einsteiger= sum(Einsteiger)) %>% top_n(4) %>% ggplot(aes(Station, Einsteiger, fill=Station)) + geom_bar(stat = "identity") + scale_y_continuous(labels = scales::comma) + theme(axis.text.x=element_blank(), axis.ticks.x=element_blank(), plot.title = element_text(hjust = 0.5)) + ggtitle("Top 5 Stations S-Bahn Hamburg 2009")
list(Station = c("Altona",....

4.3. JavaScript

For instant feedback use javascript.

var size = 12, x = [], y = [], z = [], i, j;

for (var i = 0; i < size; i++) {
	x[i] = y[i] = -2 * Math.PI + 4 * Math.PI * i / size;
  z[i] = new Array(size);
}
for (var i = 0; i < size; i++) {
	for (j = 0; j < size; j++) {
		var r2 = x[i] * x[i] + y[j] * y[j];
    z[i][j] = Math.sin(x[i]) * Math.cos(y[j]) * Math.sin(r2) / Math.log(r2+1);
 	}
}

Nextjournal.plot([{ z: z, x: x, y: y, type: 'contour' }]);

4.4. Reusing Custom Environments

Click here to take a look at the computational environment we are reusing that includes the Python package 'svgwrite'.

import math
import random
import svgwrite

dots, c, size, w, h = 100, 6.1, 4, 670, 150
phi = (1 + math.sqrt(5)) / 2
rad_phi = (math.pi * 2) / (phi + 1)
dwg = svgwrite.Drawing("/results/spiral.svg", (w, h))
a = 0
for n in range (0, dots):
  r = c * math.sqrt(n)
  x = r * math.cos (a) + w / 2
  y = r * math.sin (a) + h / 2
  color = "#%06x" % random.randint(0, 0xFFFFFF)
  dwg.add(dwg.circle ((x, y), size, fill=color))
  a += rad_phi
dwg.save()

4.5. Installing Dependencies

You can install dependencies in an article using a code cell, or you can install dependencies into a reusable environment that can be referenced and reused by members of your team.

4.6. Building Custom Environments

5. Versioning

Notebooks are fully versioned including referenced data files, results and environments.

Just click on the history button to view or restore an article (including data and computational environment) to a prior state.

6. Exporting

Export articles, data, and computational environments with a single click

6.1. Markdown

All content is exported in Nextjournal markdown format. It's a markdown file that includes Nextjournal metadata, so if you decide to import it back into Nextjournal, links to data and computational environments will be preserved.

6.2. Data

Download data by clicking the download button that is available on each dataset

6.3. Docker Images

Export docker images by clicking the 'export environment' checkbox in the 'Runtime Settings' menu.

7. Sharing

Publishing is easy on Nextjournal

  • click the 'publish' button on the control bar
  • choose a URL for your article
  • click 'Publish'

Anyone can see