Contents Previous Next

# 10 Polar plots

## 10.1 Overview

Each data point in a polar plot is represented by a tuple consisting of a radius and an angle. The polar plot itself can be either outlined or filled. In addition each point may have a standard marker (the same as for line and scatter plots).

The scale for the radius can be either linear or logarithmic.

A polar graph is created by creating an instance of PolarGraph::PolarGraph(). The polar graph type inherits all the capabilities of ordinary X-Y graphs, i.e they can have background images, background gradients, tabbed titles and so on.

Polar graphs comes in two basic types, they can either show a full 360 degree graph or a half 180 degree graph. The two examples below show these two basic types of graphs.

Figure 1: A simple 360 degree polar graph [src] | Figure 2: The 180 degree variant polar plot. [src]

## 10.2 Adjusting the radius scale

The radius axis can be shown in either a linear or logarithmic scale. This is controlled, as usual, by a call to PolarGraph::SetScale() The two examples below show the same plot in either linear or logarithmic scale

Figure 3: Using a logarithmic scale [src] | Figure 4: Using a linear scale [src]

Please note that the maximum values of the scales are different.

By default the scale will be autoscaled depending on the data. You can also specify a manual scale by supplying an extra argument to the SetScale() value. The only difference from the manual scaling with the other X-Y-graphs is that for polar graph you only specify a manual maximu. The minimum will always be 0 for the linear scale and a scaled value of 10 (i.e 1, 0.1, 0.001 and so on) for the logarithmic scale.

The plot is clipped to the plot area so if you specify a smaller scale then the maximum value that part of the plot that are outside the plotarea will be clipped.

## 10.3 Adjusting the gridlines

As usual you have full freedom to select what gridlines you like to show (and what colors they should have). There are three different types of gridlines you may adjust. The radius minor and major gridlines and the angle gridlines.

You select what gridlines to show with a call to PolarAxis::ShowGrid() The two example below shows a logarithmic plot with either just major gridlines or both minor and major gridlines.

Figure 5: Using a logarithmic scale with just major gridlines [src] | Figure 6: Using a logarithmic scale with both minor and major gridlines [src]

The colors of the gridlines are specified with a call to PolarAxis::SetGridColor()

For the angle grid lines it is possible to specify the angle division between each gridline with the method PolarAxis::SetAngleStep() You specify the step distance in degrees. By default the step size is 15 degrees.

## 10.4 Adjusting the label fonts

You can individually specify different fonts and colors for the angle and the radius labels. The radius font is specified with PolarAxis::SetFont() and the angle font is specified with a call to PolarAxis::SetAngleFont()

You can adjust the color with the method PolarAxis::SetColor() ?>

The following example specifies different colro for the labels. it also shows that you can add both a radis axis title as well as a tabbed title. In this example we have also chosen not to show the frame around the edge of the plot.

Figure 7: Different colors for labels, specifying both a tabbed title as well as a axis title [src]

## 10.5 Adjusting the labels

As can be seen from the previous examples the angle labels have a small superscripted "o" after each label. You can select if you like to show this degree mark or not witha call to the PolarAxis::SetANgleDegreeMark() method by which you can enable or disable that mark after the angels.

For the radius labels all standard formatting that can be done to the X-Y axis such as format string or format callbacks are supported.

A common modification for polar plots is probbaly to disable the display the last label when using a 360 degree plot since the last label will "collide" with the plot box around the plot area. It is possible to disable the last label with a call to Axis::HideLastTickLabel() As you can see this has been sude in some of the examples in this chapter.

## 10.6 Image maps

If you have specified markers for the polar plot (by setting the mark property of the plot) each marker can be a hotspot in a client side image map. The target URL are as usual specified with the SetCSIMTargets() as the following short code excerpt shows
`// Start by specifying the proper URL targets
$targets = array("#1","#2", ....... );
$polarplot = new PoalrPlot ($data);
$polarplot ->mark->SetType( MARK_SQUARE);
$polarplot ->SetCSIMTargets (targets);
$graph->Add( $polarplot);
$graph->StrokeCSIM();`

## 10.7 A final example

As a final example we show a full 360 degree polar plot with square markers as well as background color gradient and a legend for the plot.

Figure 8: A polar plot with both legend and background gradient fill. [src]

Contents Previous Next