## GwyColorAxis

GwyColorAxis — Axis with a false color scale

## Functions

void | (*GwyColorAxisMapFunc) ()
GtkWidget * | gwy_color_axis_new ()
GtkWidget * | gwy_color_axis_new_with_range ()
void | gwy_color_axis_get_range ()
void | gwy_color_axis_set_range ()
GwyUnit * | gwy_color_axis_get_unit ()
void | gwy_color_axis_set_gradient ()
GwyGradient * | gwy_color_axis_get_gradient ()
GwyTicksStyle | gwy_color_axis_get_ticks_style ()
void | gwy_color_axis_set_ticks_style ()
gboolean | gwy_color_axis_get_labels_visible ()
void | gwy_color_axis_set_labels_visible ()
void | gwy_color_axis_set_tick_map_func ()

## Properties

GwyGradient * | gradient | Read / Write
gboolean | labels-visible | Read / Write
GtkOrientation | orientation | Read / Write / Construct Only
GwyTicksStyle | ticks-style | Read / Write
GwyUnit * | unit | Read / Write

## Types and Values

enum | GwyTicksStyle
struct | GwyColorAxis
struct | GwyColorAxisClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GwyColorAxis

## Implemented Interfaces

GwyColorAxis implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <libgwyui/gwyui.h>

## Description

Color axis displays an axis with tick marks together with a false colour gradient. It can be used to display the false colour mapping (scale).

## Functions

### GwyColorAxisMapFunc()

    void
    (*GwyColorAxisMapFunc) (GwyColorAxis *axis,
                            const gdouble *z,
                            gdouble *mapped,
                            guint n,
                            gpointer user_data);

Type of color axis non-linear tick mapping function.

#### Parameters

axis | A color axis. |
z | Array of length `n` of tick values. |
mapped | Array of length `n` where values mapped to [0,1] should be placed. |
n | Length of `z` and `mapped` . |
user_data | Data passed to `gwy_color_axis_set_tick_map_func()`. |

### gwy_color_axis_new()

    GtkWidget *
    gwy_color_axis_new (GtkOrientation orientation);

Creates a new color axis.

#### Parameters

orientation | The orientation of the axis. |

#### Returns

The newly created color axis as a GtkWidget.

### gwy_color_axis_new_with_range()

    GtkWidget *
    gwy_color_axis_new_with_range (GtkOrientation orientation,
                                   gdouble min,
                                   gdouble max);

Creates a new color axis.

#### Parameters

orientation | The orientation of the axis. |
min | The minimum. |
max | The maximum. |

#### Returns

The newly created color axis as a GtkWidget.

### gwy_color_axis_get_range()

    void
    gwy_color_axis_get_range (GwyColorAxis *axis,
                              gdouble *min,
                              gdouble *max);

Gets the range of a color axis.

#### Parameters

axis | A color axis. |
min | Location to store the range maximum (or `NULL`). |
max | Location to store the range minimum (or `NULL`). |

### gwy_color_axis_set_range()

    void
    gwy_color_axis_set_range (GwyColorAxis *axis,
                              gdouble min,
                              gdouble max);

Sets the range of a color axis.

#### Parameters

axis | A color axis. |
min | The range minimum. |
max | The range maximum. |

### gwy_color_axis_get_unit()

    GwyUnit *
    gwy_color_axis_get_unit (GwyColorAxis *axis);

Gets the SI unit a color axis displays.

#### Parameters

axis | A color axis. |

#### Returns

The SI unit.

### gwy_color_axis_set_gradient()

    void
    gwy_color_axis_set_gradient (GwyColorAxis *axis,
                                 GwyGradient *gradient);

Sets the colour gradient a colour axis should use.

#### Parameters

axis | A color axis. |
gradient | Colour gradient the axis should show. | [transfer none][nullable]

### gwy_color_axis_get_gradient()

    GwyGradient *
    gwy_color_axis_get_gradient (GwyColorAxis *axis);

Gets the colour gradient a colour axis uses.

If no specific gradient has been set and the default one is used, the function returns `NULL`. This is consistent with getting the corresponding property. If you still need the GwyGradient object in such case, use `gwy_gradients_get_gradient()` with `NULL` argument.

#### Parameters

axis | A colour axis. |

#### Returns

The current colour gradient, possibly `NULL`.

[transfer none][nullable]

### gwy_color_axis_get_ticks_style()

    GwyTicksStyle
    gwy_color_axis_get_ticks_style (GwyColorAxis *axis);

Gets ticks style of a color axis.

#### Parameters

axis | A color axis. |

#### Returns

The ticks style.

### gwy_color_axis_set_ticks_style()

    void
    gwy_color_axis_set_ticks_style (GwyColorAxis *axis,
                                    GwyTicksStyle ticks_style);

Sets the ticks style of a color axis.

#### Parameters

axis | A color axis. |
ticks_style | The ticks style to use. |

### gwy_color_axis_get_labels_visible()

    gboolean
    gwy_color_axis_get_labels_visible (GwyColorAxis *axis);

Gets the visibility of labels of a color axis.

#### Parameters

axis | A color axis. |

#### Returns

`TRUE` if labels are displayed, `FALSE` if they are omitted.

### gwy_color_axis_set_labels_visible()

    void
    gwy_color_axis_set_labels_visible (GwyColorAxis *axis,
                                       gboolean labels_visible);

Sets the visibility of labels of a color axis.

#### Parameters

axis | A color axis. |
labels_visible | `TRUE` to display labels with minimum and maximum values, `FALSE` to display no labels. |

### gwy_color_axis_set_tick_map_func()

    void
    gwy_color_axis_set_tick_map_func (GwyColorAxis *axis,
                                      GwyColorAxisMapFunc func,
                                      gpointer user_data);

Set the tick mapping function for a color axis.

The axis calculates tick positions as for the linear axis and then places them non-linearly using `func` . Hence a mapping function should be used with ticks mode `GWY_TICKS_STYLE_UNLABELLED` because minimum tick spacing is not guaranteed.

#### Parameters

axis | A color axis. |
func | Tick mapping function. |
user_data | Data to pass to `func` . |

## Types and Values

### enum GwyTicksStyle

Axis ticks style (used in GwyColorAxis).

#### Members

GWY_TICKS_STYLE_NONE | Ticks are not drawn. |
GWY_TICKS_STYLE_CENTER | One tick is drawn at center. |
GWY_TICKS_STYLE_AUTO | A number of automatically chosen ticks are drawn at `round' values. |
GWY_TICKS_STYLE_UNLABELED | Only edge ticks are labelled, interior ticks are drawn but not labelled. |
GWY_TICKS_STYLE_UNLABELLED | Alias for `GWY_TICKS_STYLE_UNLABELED`. |

### struct GwyColorAxis

    struct GwyColorAxis;

### struct GwyColorAxisClass

    struct GwyColorAxisClass {
        GtkWidgetClass parent_class;
    };

## Property Details

### The `“gradient”` property

      “gradient”                 GwyGradient *

Color gradient the axis displays.

Owner: GwyColorAxis

Flags: Read / Write

### The `“labels-visible”` property

      “labels-visible”           gboolean

Whether minimum and maximum labels are visible.

Owner: GwyColorAxis

Flags: Read / Write

Default value: TRUE

### The `“orientation”` property

      “orientation”              GtkOrientation

Axis orientation.

Owner: GwyColorAxis

Flags: Read / Write / Construct Only

Default value: GTK_ORIENTATION_VERTICAL

### The `“ticks-style”` property

      “ticks-style”              GwyTicksStyle

The style of axis ticks.

Owner: GwyColorAxis

Flags: Read / Write

Default value: GWY_TICKS_STYLE_AUTO

### The `“unit”` property

      “unit”                     GwyUnit *

The unit of axis values.

Units are set by value. The unit object does not change. Setting the property is the same as getting the unit object and using `gwy_unit_assing()` to modify it.

Owner: GwyColorAxis

Flags: Read / Write

## See Also

GwyAxis -- Axis for use in graphs, GwyRuler -- Horizontal and vertical rulers