Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 396015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:30:37+00:00 2026-05-12T16:30:37+00:00

Further to: Choosing an attractive linear scale for a graph's Y Axis And what

  • 0

Further to: Choosing an attractive linear scale for a graph's Y Axis

And what to do when some of the points
are negative?

I believe this part of the question was not answered but it seems I can’t comment or extend that question so I’ve created a new one

Values -100, 0, 100 with 5 ticks:
  1. lower bound = -100
  2. upper bound = 100
  3. range = 100–100 = 200
  4. tick range = 40
    1. Divide by 10^2 for 0.4, translates to 0.4, which gives (multiplied by 10^2) 40.
  5. new lower bound = 40 * round(-100/40) = -80
  6. new upper bound = 40 * round(1+100/40) = 120

or

  1. new lower bound = 40 * floor(-100/40) = -120
  2. new upper bound = 40 * floor(1+100/40) = 120

Now the range has been increased to 240 (an extra tick!), with 5 ticks at 40 each.
it will take 6 steps to fill the new range!

Solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:30:38+00:00Added an answer on May 12, 2026 at 4:30 pm

    I use the following code. It produces nicely-spaced steps for human viewers and caters for ranges that pass through zero.

    public static class AxisUtil
    {
        public static float CalculateStepSize(float range, float targetSteps)
        {
            // calculate an initial guess at step size
            float tempStep = range/targetSteps;
    
            // get the magnitude of the step size
            float mag = (float)Math.Floor(Math.Log10(tempStep));
            float magPow = (float)Math.Pow(10, mag);
    
            // calculate most significant digit of the new step size
            float magMsd = (int)(tempStep/magPow + 0.5);
    
            // promote the MSD to either 1, 2, or 5
            if (magMsd > 5.0)
                magMsd = 10.0f;
            else if (magMsd > 2.0)
                magMsd = 5.0f;
            else if (magMsd > 1.0)
                magMsd = 2.0f;
    
            return magMsd*magPow;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background (question further down) I've been Googling this back and forth reading RFCs and
This is a further question based on this answer: How can I implement a
Further to this question I've got a supplementary problem. I've found a track with
Before I go any further, this IS apart of my homework.The part that I
Further to this question: MySQL - Conditional COUNT with GROUP BY Starting from the
Further to this question , I'm getting a curious result when binding a function
Further to this question and this one that I asked more recently but without
I had problem even in choosing a title for this question. Please feel free
Further to previous question , When I try to compile this I get the
Further to this question here , I'm really interested in creating my own UITabBar,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.