Tick marks

cerbere

New Member
Messages
51
Reaction score
1
Points
0
Plotting data is easy, but putting tick marks
(with values) on the horizontal and vertical
axises is harder. Plotting an arbitrary part
of an arbitrary dataset (x and y values) is what
I want to do, generating ticks accordingly.

The function to do this should take as input :

- low : left value
- high : right value of the plot
- density : approximate number of tick marks on the axis

and produce as output :

- list of tick mark positions in the axis' units
- labels (character strings for above)

Tick marks should of course be "rounded", i.e. fall
on the simplest numbers possible.

Example 1
Input :
low = -3.2564
high = 11.926
density = 4

Output :
Tick marks at -3.0, 0.0, 3.0, 6.0, 9.0

Example 2
Input :
low = 10.0017
high = 10.0058
density = 8

Output :
Ticks at 10.002 10.0025 10.003 10.0035 10.004 10.0045 10.005 10.0055

A refinement is to also produce minor, unlabeled ticks between
major (labeled) ticks.

All plotting packages do that for you, but I want to
write my own, to have better control over the final
appearance of the plot.

Any hints, suggestions or methods greatly appreciated !
 

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
I'm going to be honest here: I have absolutely no idea what you're trying to do.
What do you mean by 'tick marks'?

Are you trying to plot a graph? If so, what are you using to plot it? A program? A programming language? Which? What data are you trying to plot with? And what have you tried? What worked and what didn't?
 

xmakina

New Member
Messages
264
Reaction score
0
Points
0
Flash is probably your best option. That or javascript.
 

cerbere

New Member
Messages
51
Reaction score
1
Points
0
To clarify my question, here are some ticks for you...

That plot was generated in Perl using the GD::Graph
module. That module offers minimal support over data
windowing, especially compared to commercial
(and expensive) packages like Matlab and others.

My question is NOT about how to produce nice plots;
it is specifically about how, given the low- and high-limits
of an axis, produce a set of appropriate ticks at a
given density.
 

Attachments

  • GDDAMPPUT.JPG
    GDDAMPPUT.JPG
    62.3 KB · Views: 25

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
I am totally going off my head with this:

you could have a div with fixed height and border-right: and tell PHP to put in the width:, and repeat it as many times as need be using an if statement
 

xmakina

New Member
Messages
264
Reaction score
0
Points
0
Oh. I thought you meant ticks as in the mark you put against something correct. You meant grid lines.

And I have no idea. You're going to need some kind of dedicated chart drawing package. The only other thing I can think of is something in flash still or *perhaps* use the PHP image creator but you'd have to be bloody good at PHP to pull that off.
 

cerbere

New Member
Messages
51
Reaction score
1
Points
0
Again, I am not looking for a package or application to do
that for me, I am looking for an ALGORITHM. Whether I
implement it in Perl, PHP or effing Cobol is right now
totally unimportant for me. Please re-read my preceeding
posts with that more abstract perspective.

Related reading at :
http://phplot.sourceforge.net/phplotdocs/ref-ticks.html
http://phplot.sourceforge.net/phplotdocs/ex-lines2.html
(see how the ticks are placed at "ugly" values,
instead of 0.0 0.4 0.8 1.2 and so on ?)
http://search.cpan.org/dist/GDGraph/Graph.pm
 
Top