| 1 |
lars |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
|
|
2 |
<HTML>
|
|
|
3 |
<HEAD>
|
|
|
4 |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
|
|
|
5 |
<LINK REL="Start" HREF="index.html">
|
|
|
6 |
<LINK REL="Contents" HREF="toc.html">
|
|
|
7 |
<LINK REL="Prev" HREF="818Usinglogarithmicscale.html">
|
|
|
8 |
<LINK REL="Next" HREF="8110Adjustingthegridlinesintheplot.html">
|
|
|
9 |
<STYLE TYPE="text/css"><!--
|
|
|
10 |
BODY { font-family: serif }
|
|
|
11 |
H1 { font-family: sans-serif }
|
|
|
12 |
H2 { font-family: sans-serif }
|
|
|
13 |
H3 { font-family: sans-serif }
|
|
|
14 |
H4 { font-family: sans-serif }
|
|
|
15 |
H5 { font-family: sans-serif }
|
|
|
16 |
H6 { font-family: sans-serif }
|
|
|
17 |
SUB { font-size: smaller }
|
|
|
18 |
SUP { font-size: smaller }
|
|
|
19 |
PRE { font-family: monospace }
|
|
|
20 |
A { text-decoration: none }
|
|
|
21 |
--></STYLE>
|
|
|
22 |
</HEAD>
|
|
|
23 |
<BODY>
|
|
|
24 |
<A HREF="toc.html">Contents</A>
|
|
|
25 |
<A HREF="818Usinglogarithmicscale.html">Previous</A>
|
|
|
26 |
<A HREF="8110Adjustingthegridlinesintheplot.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H3><A NAME="8_1_9">8.1.9 More on scales</A></H3>
|
|
|
29 |
<P> As you saw in the previous example it is possible to use different
|
|
|
30 |
types of scales. In JpGraph you can use the following scales</P>
|
|
|
31 |
<UL>
|
|
|
32 |
<LI>Linear scale, the standard "scale"</LI>
|
|
|
33 |
<LI>Logarithmic scale</LI>
|
|
|
34 |
<LI>Integer scale, very similar to linear scale but restricts the scale
|
|
|
35 |
values (and labels) to integer values.</LI>
|
|
|
36 |
<LI>Text scale, Similar to integer scale and used when only the
|
|
|
37 |
numbering of items is relevant. A text scale is almost exclusively used
|
|
|
38 |
for the X-axis. A typical example for this is the X-axis for a bar
|
|
|
39 |
plot. The labels for the text scale is usually replaced by user
|
|
|
40 |
supplied texts. Text scales can only be used for the X-axis (it doesn't
|
|
|
41 |
make sense for the Y-scale).</LI>
|
|
|
42 |
</UL>
|
|
|
43 |
<P> Any combination of these may be used. Linear and logarithmic scales
|
|
|
44 |
are pretty straightforward. The text scale might deserve some
|
|
|
45 |
explanation. The easiest way to think of the text scale is as a linear
|
|
|
46 |
scale consisting of only natural numbers, i.e. 0,1,2,3,4,... . This
|
|
|
47 |
scale is used when you just have a number of Y-values you want to plot
|
|
|
48 |
in a consecutive order and don't care about the X-values. For the above
|
|
|
49 |
example it will also work fine to use a linear X-scale (try it!).
|
|
|
50 |
However, the scale is now treated as consisting or real numbers so the
|
|
|
51 |
auto scaling, depending on the size of the image an the number of data
|
|
|
52 |
points, might decide to display other labels then the natural numbers.,
|
|
|
53 |
i.e. a label might be 2.5 say. This is not going to happen if you use a
|
|
|
54 |
text scale.</P>
|
|
|
55 |
<P> The normal practice for text scale is to specify text strings as
|
|
|
56 |
labels instead as the default natural numbers. You can specify text
|
|
|
57 |
strings for the labels by calling the <A href="../ref/Axis.html#_AXIS_SETTICKLABELS">
|
|
|
58 |
SetTickLabels()</A> method on the Axis.</P>
|
|
|
59 |
<P> To specify the scale you use the <A href="../ref/Graph.html#_GRAPH_SETSCALE">
|
|
|
60 |
SetScale()</A> method. A few examples might help clarify this.</P>
|
|
|
61 |
<UL>
|
|
|
62 |
<LI> "textlin", text-scale for X-axis, Linear scale for Y-axis</LI>
|
|
|
63 |
<LI> "linlin", linear-scale for X-axis, Linear scale for Y-axis</LI>
|
|
|
64 |
<LI> "linlog", linear-scale for X-axis, Logarithmic scale for Y-axis</LI>
|
|
|
65 |
<LI> "loglog", Logarithmic scale for X-axis, Logarithmic scale for
|
|
|
66 |
Y-axis</LI>
|
|
|
67 |
<LI> "textint", text-scale for X-axis, Integer scale for Y-axis</LI>
|
|
|
68 |
<LI> "textlog", Text scale for X-axis, Logarithmic scale for Y-axis</LI>
|
|
|
69 |
</UL>
|
|
|
70 |
<P> As you can see all your graphs will require at least one call to
|
|
|
71 |
SetScale() in the beginning of your script. Normally it will come right
|
|
|
72 |
after the creation of the Graph().</P>
|
|
|
73 |
<P> To specify the scale for the Y2 axis you use the <A href="../ref/Graph.html#_GRAPH_SETY2SCALE">
|
|
|
74 |
SetY2Scale()</A> Since you only specify one axis you only specify
|
|
|
75 |
"half" of the string in the previous examples. So to set a logarithmic
|
|
|
76 |
Y2 scale you will call
|
|
|
77 |
<!--?
|
|
|
78 |
$t ='$grap-->
|
|
|
79 |
SetY2Scale("log");'; ShowCodeSnippet($t); ?></P>
|
|
|
80 |
<HR NOSHADE>
|
|
|
81 |
<A HREF="toc.html">Contents</A>
|
|
|
82 |
<A HREF="818Usinglogarithmicscale.html">Previous</A>
|
|
|
83 |
<A HREF="8110Adjustingthegridlinesintheplot.html">Next</A>
|
|
|
84 |
</BODY>
|
|
|
85 |
</HTML>
|