API Reference
For figure layout, the most useful functions will be updater
to construct a common object, plot_figures
to place figures in the document, relative_dimensions
for sizing plots correctly.
The ids
function can sometimes be useful for debugging purposes.
figure_second.plot_figures
— Methodplot_figures(updater::Updater, figure_map::Dict{String, Makie.Figure})
updater is a wrapper around the python class. It represents the inkscape svg document we are plotting on.
figure_map is a dictionary with keys containing id
s of inkscape objects (rectangles or images) to plot on top of. The values of figure_map
are figures to render.
The user is responsible for filling each figure with content, and sizing it appropriately to the dimensions of the inkscape object. See relative_dimensions
for sizing considerations.
figure_second.plot_figures
— Methodplot_figures(updater::Updater, figure_map::Dict{String, Plots.Plot})
updater is a wrapper around the python class. It represents the inkscape svg document we are plotting on.
figure_map is a dictionary with keys containing id
s of inkscape objects (rectangles or images) to plot on top of. The values of figure_map
are figures to render (outputs of Plots.jl
plot()
functions.
The user is responsible for filling each figure with content, and sizing it appropriately to the dimensions of the inkscape object. See relative_dimensions
for sizing considerations.
figure_second.python_bindings.Dimensions
— TypeDimensions(width::Float64, height::Float64)
raw dimensions of an inkscape object.
figure_second.python_bindings.Updater
— TypeUpdater
representation of an inkscape document. An Updater
can either mutate an the underlying inkscape file. or export to a new file See documentation on the constructor (updater
)
figure_second.python_bindings.dimensions
— Methoddimensions(updater::Updater, id::String)::Dimensions
parse the raw dimensions of an inkscape object with id id
and return them as a Dimensions
object
figure_second.python_bindings.ids
— Methodids(updater::Updater)::Vector{String}
fetch all valid id
s from the base_path
document of an Updater
figure_second.python_bindings.relative_dimensions
— Methodrelative_dimensions(updater::Updater, id::String, height::Float64)::Tuple{Float64, Float64}
Calculate the required dimension pair (width, height)
to maintain the aspect ratio of the inkscape object. Returns result in fractional units.
figure_second.python_bindings.relative_dimensions
— Methodrelative_dimensions(updater::Updater, id::String, height::Int)::Tuple{Int, Int}
Calculate the required dimension pair (width, height)
to maintain the aspect ratio of the inkscape object. Rounds the otherwise float point value and converts to Int
.
This is useful for plotting functions that expect an interger number for pixel dimensions
figure_second.python_bindings.update
— Methodupdate(updater::Updater, map::Dict{String, String})
low level function to update the contents of an inkscape file. The map
argument maps an inkscape object's id
to a file path containing a .png
encoded image. The .png
encoded image (dictionary value) will be placed in the inkscape object with the id of the key.
figure_second.python_bindings.updater
— Methodupdater(base_path::String, output_file::String)::Updater
Updater
constructor for a workflow that reads in a file base_path
and exports all changes under a new file output_file
.
This Updater
instance will not mutate the underlying base_path
inkscape file
figure_second.python_bindings.updater
— Methodupdater(base_path::String)::Updater
Updater
constructor for a workflow that reads in a file base_path
and mutates it in place with all plotting changes.