octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rudimentary tick positions


From: John W. Eaton
Subject: rudimentary tick positions
Date: Tue, 05 Feb 2008 17:35:28 -0500

On  4-Feb-2008, Shai Ayal wrote:

| attached is a patch for rudimentary tick position calculations. It is
| a translation of Tom Holroyd's python code which he posted to this
| list some weeks ago (Tom, I hope that by posting the code here you
| agreed to it's use in octave ...).
| What is missing is:
| *) log axes ticks
| *) minor ticks
| *) does not take into account the axes size and font size to eliminate
| tick overruns
| *) gnuplot interaction
| *) your favorite feature here

OK.  We will obviously need computatino of tics for log scales before
we can use the computed tics for gnuplot.  OTOH, the tics generated by
gnuplot are not currently available in Octave anyway, so the fact that
they will be different is not a new bug...

| Still, I think it is good enough to serve as a basis to the above 
improvements.

OK, I applied this patch and checked it in.

Instead of

| +  if (a < 1.41) // sqrt(2)
| +    x = 1;
| +  else if (a < 3.16) // sqrt(10)
| +    x = 2;
| +  else if (a < 7.07) // sqrt(50)
| +    x = 5;
| +  else
| +    x = 10;

I used

  static const double sqrt_2 = sqrt (2.0);
  static const double sqrt_10 = sqrt (10.0);
  static const double sqrt_50 = sqrt (50.0);

  if (a < sqrt_2)
    x = 1;
  else if (a < sqrt_10)
    x = 2;
  else if (a < sqrt_50)
    x = 5;
  else
    x = 10;


Thanks,

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]