New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nicer symlog ticks? #162
Comments
Yea, I thought about this, and I think the Webber paper does specify how to choose an appropriate bound for the power based on the constant. But clearly I didn’t spend the time to implement it. Contributions welcome! |
I've spent a few hours today trying to get this working, but I'm still not sure that my method is correct — and the integration is clearly not finished. Pushing to Fil@aea855f in order to maybe help the next person who wants to volunteer — but so many things are still not working; and tests. |
I have made little modification to scaleLog ticks and it seems to work pretty well. It basically updates I am not so much in d3 internal code and also have not written tests so far so I leave it here for now.
|
While waiting for the new symlog scale, a quick workaround is to keep linear scale, symlog the data values then manipulate the axis tick format as:
|
Hi. I came across the same issue, d3.scalesymlog() producing same ticks as the linear scale. Is there any update on this issue? or a workaround that works. I'm trying to display log for + and - values. I could not make @yitelee solution work for my case? Appreciate any pointers here. |
Hi, |
I can comment on what some people and I at my company did for a scaleSequentialSymlog, since it was much more pain than it should be. Here are some revelations that will hopefully help you out
And the rest is just messing around to make the ticks look better. Basically, here is the psuedo-code
I'd post the non-psuedocode, but it's filled with complexities of our implementation you may also want to clean up the points that aren't a power of your base, so that their values don't get squishy. You'd use a method like the following within a different tickFormat function // don't claim this is a good algorithm, it works (base 10)
keepTickValue(tick: number): boolean {
if (tick === -1 || tick === 0 || tick === 1) {
return true;
} else {
let remainder = tick % 10;
if (remainder === 0) {
if (Math.abs(tick) > 10) {
return this.keepTickValue(tick / 10);
} else {
return true;
}
} else {
return false;
}
}
} then you plot, using the scaleSequentialSymlog // Draw legend
this.legend({
color: this.color,
title: this.title,
width: this.width - 200,
tickFormat: (x) => this.formatTick(x),
tickValues: this.my_ticks,
}); Here is what ours ended up looking like |
The new symlog scale appears to use the same tick generation logic as the linear scale. This can result in axes with large gaps when spanning multiple orders of magnitude. It would be nice to have ticks more akin to those provided by log scales, providing a better guide for large value spans!
We've had requests for symlog in Vega-Lite and Altair, so I'm anticipating this same request will hit our repos once we release new versions using d3-scale 2.2+.
The text was updated successfully, but these errors were encountered: