Vega-Lite-shaped specification types for fortplot
Defines Fortran derived types that map 1:1 to Vega-Lite schema fields. These types serve as the single source of truth for plot specifications, decoupling frontend API from backend rendering.
The Fortran API builds spec_t directly (no JSON overhead). JSON is a serialization layer for interop with Vega ecosystem.
Axis configuration (maps to Vega-Lite axis object)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | title | |||
| logical, | public | :: | grid | = | .false. | ||
| real(kind=wp), | public | :: | grid_opacity | = | -1.0_wp | ||
| real(kind=wp), | public | :: | label_angle | = | 0.0_wp | ||
| logical, | public | :: | title_set | = | .false. | ||
| real(kind=wp), | public, | allocatable | :: | tick_values(:) | |||
| character(len=:), | public, | allocatable | :: | format |
Scale configuration (maps to Vega-Lite scale object) Supported types: linear, log, pow, sqrt, symlog, ordinal, band, point
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | type | |||
| real(kind=wp), | public | :: | domain_min | = | 0.0_wp | ||
| real(kind=wp), | public | :: | domain_max | = | 0.0_wp | ||
| logical, | public | :: | domain_set | = | .false. | ||
| logical, | public | :: | zero | = | .false. | ||
| real(kind=wp), | public | :: | exponent | = | 1.0_wp |
Encoding channel (maps to Vega-Lite channel object) Connects a data field to a visual property.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | field | |||
| character(len=:), | public, | allocatable | :: | type | |||
| type(scale_t), | public | :: | scale | ||||
| type(axis_t), | public | :: | axis | ||||
| character(len=:), | public, | allocatable | :: | value | |||
| logical, | public | :: | defined | = | .false. |
Encoding specification (maps to Vega-Lite encoding object) Maps data fields to visual channels.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(channel_t), | public | :: | x | ||||
| type(channel_t), | public | :: | y | ||||
| type(channel_t), | public | :: | x2 | ||||
| type(channel_t), | public | :: | y2 | ||||
| type(channel_t), | public | :: | color | ||||
| type(channel_t), | public | :: | size | ||||
| type(channel_t), | public | :: | shape | ||||
| type(channel_t), | public | :: | opacity | ||||
| type(channel_t), | public | :: | text |
Mark specification (maps to Vega-Lite mark object) Defines the visual representation type and properties.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | type | |||
| real(kind=wp), | public | :: | size | = | -1.0_wp | ||
| real(kind=wp), | public | :: | opacity | = | 1.0_wp | ||
| real(kind=wp), | public | :: | stroke_width | = | -1.0_wp | ||
| real(kind=wp), | public, | allocatable | :: | stroke_dash(:) | |||
| character(len=:), | public, | allocatable | :: | stroke | |||
| character(len=:), | public, | allocatable | :: | fill | |||
| logical, | public | :: | filled | = | .true. | ||
| character(len=:), | public, | allocatable | :: | interpolate | |||
| character(len=:), | public, | allocatable | :: | point |
Single named column of data values
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | field | |||
| real(kind=wp), | public, | allocatable | :: | values(:) | |||
| character(len=:), | public, | allocatable | :: | string_values(:) | |||
| logical, | public | :: | is_string | = | .false. |
Data specification (maps to Vega-Lite data object) Stores inline values as named columns (Fortran-native layout). Serialized to row-oriented JSON for Vega-Lite compatibility.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(data_column_t), | public, | allocatable | :: | columns(:) | |||
| integer, | public | :: | nrows | = | 0 |
fortplot-specific field-plot metadata carried alongside the Vega-Lite-shaped spec for contour, pcolormesh, and streamplot data.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public, | allocatable | :: | x(:) | |||
| real(kind=wp), | public, | allocatable | :: | y(:) | |||
| real(kind=wp), | public, | allocatable | :: | z(:) | |||
| real(kind=wp), | public, | allocatable | :: | u(:) | |||
| real(kind=wp), | public, | allocatable | :: | v(:) | |||
| real(kind=wp), | public, | allocatable | :: | levels(:) | |||
| integer, | public | :: | nrows | = | 0 | ||
| integer, | public | :: | ncols | = | 0 | ||
| logical, | public | :: | defined | = | .false. | ||
| character(len=:), | public, | allocatable | :: | colormap | |||
| logical, | public | :: | show_colorbar | = | .false. | ||
| logical, | public | :: | show_colorbar_set | = | .false. | ||
| real(kind=wp), | public | :: | density | = | -1.0_wp | ||
| real(kind=wp), | public | :: | vmin | = | 0.0_wp | ||
| real(kind=wp), | public | :: | vmax | = | 0.0_wp | ||
| logical, | public | :: | vmin_set | = | .false. | ||
| logical, | public | :: | vmax_set | = | .false. | ||
| real(kind=wp), | public | :: | linewidths | = | -1.0_wp |
Single layer within a layered spec
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(mark_t), | public | :: | mark | ||||
| type(encoding_t), | public | :: | encoding | ||||
| type(data_t), | public | :: | data | ||||
| type(field_plot_t), | public | :: | field | ||||
| logical, | public | :: | has_data | = | .false. |
Top-level Vega-Lite specification Single source of truth for a plot. The Fortran plot() API is syntactic sugar that builds a spec_t.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | schema | |||
| type(mark_t), | public | :: | mark | ||||
| type(encoding_t), | public | :: | encoding | ||||
| type(data_t), | public | :: | data | ||||
| type(field_plot_t), | public | :: | field | ||||
| character(len=:), | public, | allocatable | :: | title | |||
| integer, | public | :: | width | = | 400 | ||
| integer, | public | :: | height | = | 300 | ||
| type(layer_t), | public, | allocatable | :: | layers(:) | |||
| integer, | public | :: | layer_count | = | 0 | ||
| logical, | public | :: | is_layered | = | .false. | ||
| type(config_t), | public | :: | config | ||||
| type(padding_t), | public | :: | padding | ||||
| character(len=:), | public, | allocatable | :: | autosize_type |