Given a comma separated values (.csv
) file, plot columns with xyfigure
t
(the x-axis), and two functions (two different data series for the y-axis) of time columns sin(t)
and cos(2t)
.Create a virtual environment:
cd ~/sibl
python -m venv .venv
Activate the virtual environment:
source ~/sibl/.venv/bin/activate
cd ~/sibl/cli
pip install -e .
With the input recipe.yml:
xyfigure io/example/recipe.yml
Output:
Processing file: io/example/recipe.yml
Finished XYViewBase constructor.
Creating view with guid = "figure"
Adding all models to current view.
Figure dpi set to 100
Figure size set to [8.0, 6.0] inches.
Serialized view to: /Users/chovey/sibl/cli/io/example/recipe.png
====================================
End of xyfigure execution.
Result:
A minimum working example, with recipe_minimal.yml:
xyfigure io/example/recipe_minimal.yml
Output:
Processing file: io/example/recipe_minimal.yml
Finished XYViewBase constructor.
Creating view with guid = "figure-output"
Adding all models to current view.
Figure dpi set to 100
Figure size set to [11.0, 8.5] inches.
No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
Serialized view to: /Users/chovey/sibl/cli/io/example/recipe_minimal.png
====================================
End of xyfigure execution.
Result:
An elaborate example, with recipe_with_background.yml:
xyfigure io/example/recipe_with_background.yml
Output:
Processing file: io/example/recipe_with_background.yml
Finished XYViewBase constructor.
Creating view with guid = "figure"
Adding all models to current view.
Figure dpi set to 100
Figure size set to [8.0, 6.0] inches.
Serialized view to: /Users/chovey/sibl/cli/io/example/recipe_with_background.png
====================================
End of xyfigure execution.
Result:
Deprecation Warning:
.json
files still work as input files, but they have been deprecated on 2024-12-16 in favor a.yml
format input files. —
Here we create an example data file from an Excel spreadsheet and walk through the steps to create a simple xyfigure
.
t
(the x-axis), and two functions (two different data series for the y-axis) of time columns sin(t)
and cos(2t)
.$ cd ~/sibl/cli/io/example/
$ python ~/sibl/cli/src/xyfigure/client.py recipe.json
The output file recipe.svg
contains this figure:
will result, written to the ~/sibl/cli/io/example/
folder.
Most of the keywords documented in the documentation are optional. If the optional keywords are not specified, xyfigure
selects sensible default values. Users override the default behaviour by specifying the optional keywords.
Here is the sine and cosine example from above, as a minimal json file, with only two optional keywords:
ycolumn
, to specify the location of the cosine data in the data.csv
file, andserialize
, to write the generated figure to disc.From the folder that contains the json file, run the Python script:
$ cd ~/sibl/cli/io/example/
$ python ~/sibl/cli/src/xyfigure/client.py recipe_minimal.json
Here is the output:
Here we plot the chess board image behind the figure, and override the default tick marks with some specific tick marks. We also use the alpha channel for a transparent chess board appearance.
The json file results in this figure: