FramedPlot¶
This object represents a framed plot, where the axes surround the plotting region, instead of intersecting it. You build a plot by adding components:
p = FramedPlot()
add(p, component...)
Components are rendered in the order they’re added.
Basic Attributes¶
| xlabel | String | The x-axis label (bottom of the frame). |
| xlog | Bool | If true use log scaling, otherwise linear. |
| xrange | (Real,Real) | |
| ylabel | String | The y-axis label (left of the frame). |
| ylog | Bool | If true use log scaling, otherwise linear. |
| yrange | (Real,Real) |
These should be sufficient for casual use, but often you’ll want greater control over the frame.
Axis Attributes¶
Each side of the frame is an independent axis object: p.x1 (bottom),
p.y1 (left), p.x2 (top), and p.y2 (right). The axis
attributes below apply to each of these objects. So for example, to
label the right side of the frame, you would say:
setattr( p.y2, "label", "something" )
The label, log, and range attributes are the same as the ones above. For
instance, when you set p.xlog you’re actually setting p.x1.log.
| draw_axis | Bool | If false the spine, ticks, and subticks are not drawn; otherwise it has no effect. |
| draw_grid | Bool | Grid lines are parallel to and coincident with the ticks. |
| draw_nothing | Bool | If true nothing is drawn; otherwise it has no effect. |
| draw_spine | Bool | The spine is the line perpendicular to the ticks. |
| draw_subticks | Nothing | Bool | If set to nothing subticks will be drawn only if ticks are drawn. |
| draw_ticks | Bool | |
| draw_ticklabels | Bool | |
| grid_style | Style | |
| label | String | |
| label_offset | Real | |
| label_style | Style | |
| log | Bool | |
| range | (Real, Real) | |
| spine_style | Style | |
| subticks | Nothing | Integer | Real[] | Similar to ticks, except when set to an integer it sets the number of subticks drawn between ticks, not the total number of subticks. |
| subticks_size | Real | |
| subticks_style | Style | |
| ticks | Nothing | Integer | Real[] | If set to nothing ticks will be automagically generated. If set to an integer n, n equally spaced ticks will be drawn. You can provide your own values by setting ticks to a sequence. |
| ticks_size | Real | |
| ticks_style | Style | |
| tickdir | +1 | -1 | This controls the direction the ticks and subticks are drawn in. If +1 they point toward the ticklabels and if -1 they point away from the ticklabels. |
| ticklabels | Nothing | String[] | Ticklabels are the labels marking the values of the ticks. You can provide your own labels by setting ticklabels to a list of strings. |
| ticklabels_dir | +1 | -1 | |
| ticklabels_offset | Real | |
| ticklabels_style | Style |
So let’s say you wanted to color all the ticks red. You could write:
# XXX:doesn't work yet
p.x1.ticks_style["color"] = "red"
p.x2.ticks_style["color"] = "red"
p.y1.ticks_style["color"] = "red"
p.y2.ticks_style["color"] = "red"
but it’s tedious, and hazardous for your hands. FramedPlot provides
a mechanism for manipulating groups of axes, through the use of the
following pseudo-attributes:
frame ==> .x1, .x2, .y1, .y2
frame1 ==> .x1, .y1
frame2 ==> .x2, .y2
x ==> .x1, .x2
y ==> .y1, .y2
which lets you write:
# XXX:doesn't work yet
p.frame.ticks_style["color"] = "red"
instead.