sibl

xyfigure

Given a comma separated values (.csv) file, plot columns with xyfigure

Getting Started

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 .

Example 1

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:

recipe.png

Example 2

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:

recipe_minimal.png

Example 3

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:

recipe_with_background.png


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. —

Getting Started

Here we create an example data file from an Excel spreadsheet and walk through the steps to create a simple xyfigure.

Workflow

The output file recipe.svg contains this figure:

recipe

will result, written to the ~/sibl/cli/io/example/ folder.

Getting Minimalistic

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:

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: recipe_minimal

Getting More Sophisticated

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:

recipe_with_background