Saving Files
Last updated
Was this helpful?
Last updated
Was this helpful?
At the end of a run, files found in the /results
folder are collected and made available in the Reproduciblity pane, where users can view and download them. Files saved elsewhere will be discarded at the end of the run.
Results will be labeled Published Result in the Reproducibility pane:
Code Ocean has no built-in display. This is called , code executed this way is said to be run in . Plots, figures, and other graphics must be saved explicitly to the /results
folder.
Use either print
or saveas
. The following snippet will save the same plot twice:
matplotlib
is common for saving python graphics on Code Ocean.
Install matplotlib
via a .
to Agg
first.
In base R, you must call a graphics device:
Plot your graph
Save ggplot2
has different syntax.
If your code is already structured to save figures somewhere besides /results
, use the Linux commands mv
or ln -s
.
Each capsule begins with a shell script called run.sh
. In this file, use the command mkdir -p
to create sub-folders within /results
. If you want to have all the figures in one subfolder and all the tables in another, at the end of the analysis, you would write something like:
To move figures currently saving to a folder called figures
, write ln -s ../results ./figures
in a (typically called run.sh
on Code Ocean) before you run your analyses. If you are saving png files to the home directory, and if you have no png files there at the outset, write mv *.png ../result
in a shell script. The *
character is and the command will apply to all files ending in.png
. You may also use to move multiple types of files to /results
, for example, mv *.{png,jpg,tiff} ../results
.
Alternatively, you can save the results of different analyses into different subfolders, as can be seen in the run.sh
script of .