Could somebody provide a simple explanation of the JFreeChart axis-types?
First, we have the axes that are based on the class hierarchy (ValueAxis, CategoryAxis, lots of subclasses)
We also have the "domain axis" versus "range axis" distinction (only for xy plots?). It is not entirely clear how these relate to the class-hierarchy-based axes. These are not classes but there are setDomainAxis and setRangeAxis methods in XYPlot.
Visually I would think in horizontal and vertical axes, I am not sure how these are related to the previous concepts (is "domain" always horizontal?). I think that the x-axis is horizontal and the y-axis vertical, but I am not sure whether this is always the case with XYPlot.
EDIT: I tried to study both the API docs and the developer guide. The API docs just give a hierarchy of classes, but it is not clear when and how to use them. The developer guide also gives no definition or explanation of "domain axis" and "range axis", it just uses these terms. I admit that the question is broad, it is because I could not find this basic information anywhere. I wanted to have a general understanding, but my most important question at the moment is what determines what gets to be on the horizontal/vertical axis (is "domain" always horizontal? if not how to set it?) because I am getting some crazy results and I don't know where to start the debugging. It is also not clear whether I should use CombinedRangeXYPlot or CombinedDomainXYPlot if I want the two plots to be placed one above the other.
EDIT2: Although this was not answered, I found out in the meantime what determines whether the domain axis is horizontal: the PlotOrientation setting. This setting (on the level of combined plot) also determines whether CombinedRangeXYPlot/CombinedDomainXYPlot arrange the two plots horizontally or vertically.
In a XYPlot
, every series that you are displaying represents a discrete function f[t]
with a discrete set of t's {t1, t2, ..., tn} and their corresponding values {f[t1], f[t2], ..., f[tn]}.
t
. f[t]
. The important thing here is that there can be multiple points in the function with the same value in the range axis, but every point of the function has to have a unique value in the domain axis. For instance: Bananas can have the same prize as Apples, but there can not be two prizes for a Banana (tell that to the brokers! :P).
Usually, the horizontal axis is the domain axis, but that can also be changed.
Then you have the class Axis
which holds a lot of possible types of visual representations of axes (logarithmic/linear/category/no labels/gridlines/blue colored axis line...).
So in summary: Domain and range are mathematical definitions and pose some constraints on the displayed data. The terms are used for a special kind of data (the classical form of a function that everybody learns in basic school). They have nothing to do with their visual represenation. So the range as well as the domain axis of a plot can be defined to be a CategoryAxis
, a NumberAxis
, a LogarithmicAxis
or something else.
EDIT (for completeness): You can change the orientation of the plot (i.e. define, which of the axes is the range axis) using PlotOrientation.VERTICAL
/PlotOrientation.HORIZONTAL
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With