Skip to content

Adopt zygos for scaling logic - #611

Open
thomasp85 wants to merge 6 commits into
mainfrom
zygos
Open

thomasp85 wants to merge 6 commits into
mainfrom
zygos

Conversation

@thomasp85

Copy link
Copy Markdown
Collaborator

This PR moves as much scaling logic as possible to the new zygos crate so that ggsql and hephaestus can share it

Part of this work incidentally fixes #512

@thomasp85

Copy link
Copy Markdown
Collaborator Author

Before merging this Hephaestus 0.5.0 needs to be released and ggsql needs to depend on that due to slight changes in where linetype conversion responsibility is located

@thomasp85
thomasp85 requested a review from teunbrand November 5, 2026 15:21
Comment thread doc/syntax/scale/type/binned.qmd Resolved
Comment thread doc/syntax/scale/type/continuous.qmd Resolved
Comment thread src/plot/scale/scale_type/mod.rs Resolved
);

// Natural log - just verify non-empty
// Natural log over more than four e-folds: the powers of e alone.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this is putting breaks at powers of $e$? Doesn't that look abhorrent?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in zygos

Comment thread src/plot/scale/breaks.rs Resolved
Comment thread src/writer/hephaestus/scales.rs Resolved
/// by spaces; Vega-Lite fills them with the evenodd fill-rule. Returns
/// `None` for unknown shapes.
pub fn shape_to_svg_path(name: &str) -> Option<String> {
let shape = zygos::patterns::shape::builtin_shape(name)?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little bit confused, who owns the shape registry: zygos or hephaestus?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zygos owns a registry of predefined shapes. This is a fixed list that hephaestus use to init it's own registry that can be expanded by the consumer

.unwrap_or_default()
}
_ => derive(resolved_transform.default_minor_break_count()),
_ => match (major_interval, resolved_transform.temporal_unit(), extent) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that this is currently hardcoded to a monday grid AFAICT, whereas in some cultures weeks start at sunday. Not important for the PR as a whole.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, at some point we have to decide how much we want locale to influence these kind of things

) -> Vec<f64> {
minor_breaks_symlog(major_breaks, n, range)
extent_minor_breaks(major_breaks, n, range, |min, max| {
symlog_minor_breaks(min, max, BREAK_BASE)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of a taste comment intended for zygos rather than this PR, but I'd argue that in the 'range includes 0'-case the minor breaks are a little bit too dense near 0. Same for pseudo_log transform.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in zygos

Comment thread src/plot/scale/transform/log.rs Resolved
@thomasp85
thomasp85 requested a review from teunbrand November 9, 2026 13:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scale expansion is computed in linear data space and then clipped, collapsing log domains

2 participants