[goffice] New matrix plots. [#657918][#680806]



commit 563eb820b2cd5679a0b2284b3f8403fe93bf8f20
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sun Jun 9 14:43:25 2013 +0200

    New matrix plots. [#657918][#680806]

 ChangeLog                                     |   28 +
 NEWS                                          |    1 +
 goffice/graph/gog-axis.c                      |    2 +-
 goffice/graph/gog-axis.h                      |    2 +-
 goffice/graph/gog-chart.c                     |   14 +-
 goffice/graph/gog-renderer.c                  |    2 +-
 plugins/plot_surface/Makefile.am              |   11 +-
 plugins/plot_surface/chart_contour_2_2.png    |  Bin 0 -> 2805 bytes
 plugins/plot_surface/chart_contour_2_2.svg    |  241 +++++++
 plugins/plot_surface/chart_matrix_1_1.png     |  Bin 0 -> 1806 bytes
 plugins/plot_surface/chart_matrix_1_1.svg     |  533 ++++++++++++++++
 plugins/plot_surface/chart_matrix_1_2.png     |  Bin 0 -> 2197 bytes
 plugins/plot_surface/chart_matrix_1_2.svg     |  543 ++++++++++++++++
 plugins/plot_surface/chart_matrix_1_3.png     |  Bin 0 -> 2085 bytes
 plugins/plot_surface/chart_matrix_1_3.svg     |  543 ++++++++++++++++
 plugins/plot_surface/chart_surface_2_3.png    |  Bin 0 -> 4230 bytes
 plugins/plot_surface/chart_surface_2_3.svg    |  828 +++++++++++++++++++++++++
 plugins/plot_surface/gog-contour.c            |   22 +-
 plugins/plot_surface/gog-contour.h            |    5 +-
 plugins/plot_surface/gog-matrix.c             |  229 +++++++
 plugins/plot_surface/gog-matrix.h             |   50 ++
 plugins/plot_surface/gog-surface.c            |   10 +-
 plugins/plot_surface/gog-xyz-surface-prefs.c  |   29 +-
 plugins/plot_surface/gog-xyz-surface-prefs.ui |   25 +-
 plugins/plot_surface/gog-xyz-surface.c        |  634 ++++++++++++++++----
 plugins/plot_surface/gog-xyz-surface.h        |   88 +++
 plugins/plot_surface/gog-xyz.c                |   24 +-
 plugins/plot_surface/gog-xyz.h                |    4 +-
 plugins/plot_surface/matrix.xpm               |   29 +
 plugins/plot_surface/plot-types.xml.in        |   26 +
 plugins/plot_surface/plugin.xml.in            |   28 +
 plugins/plot_surface/xl-surface.c             |   11 +-
 32 files changed, 3804 insertions(+), 158 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ec69825..0d229a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2013-06-09  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/graph/gog-axis.c (gog_axis_get_color_scale): make public.
+       * goffice/graph/gog-axis.h: ditto.
+       * goffice/graph/gog-chart.c: ensure that contour plot slices don't appear in
+       legend when a color scale is used.
+       * plugins/plot_surface/chart_contour_2_2.svg: new pixmaps.
+       * plugins/plot_surface/chart_matrix_1_1.svg: ditto.
+       * plugins/plot_surface/chart_matrix_1_2.svg: ditto.
+       * plugins/plot_surface/chart_matrix_1_3.svg: ditto.
+       * plugins/plot_surface/chart_surface_2_3.svg: ditto.
+       * plugins/plot_surface/Makefile.am: new files.
+       * plugins/plot_surface/gog-contour.c: make compatible with XY plots.
+       * plugins/plot_surface/gog-contour.h: ditto.
+       * plugins/plot_surface/gog-matrix.c: new matrix plots. [#657918][#680806]
+       * plugins/plot_surface/gog-matrix.h:
+       * plugins/plot_surface/gog-surface.c: make compatible with XY plots.
+       * plugins/plot_surface/gog-xyz-surface-prefs.c: ditto.
+       * plugins/plot_surface/gog-xyz-surface-prefs.ui: ditto.
+       * plugins/plot_surface/gog-xyz-surface.c: add new plot types.
+       * plugins/plot_surface/gog-xyz-surface.h: ditto.
+       * plugins/plot_surface/gog-xyz.c: ditto.
+       * plugins/plot_surface/gog-xyz.h: ditto.
+       * plugins/plot_surface/matrix.xpm: new pixmap
+       * plugins/plot_surface/plot-types.xml.in: add new plot types.
+       * plugins/plot_surface/plugin.xml.in: ditto.
+       * plugins/plot_surface/xl-surface.c: make compatible with XY plots.
+
 2013-06-03  Jean Brefort  <jean brefort normalesup org>
 
        * goffice/graph/gog-label.c (gog_reg_eqn_populate_editor): allow regression
diff --git a/NEWS b/NEWS
index d271667..b018bcf 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Jean:
        * Implement color scales. [#695829]
        * Allow color scales to have titles. [#688595]
        * Allow regression equation frame to rotate with text. [#701546]
+       * New matrix plots. [#657918][#680806]
 
 Morten:
        * Fix issue with librsvg includes.  [#695167]
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index 0a357e1..7331a30 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -3556,7 +3556,7 @@ gog_axis_get_color_map (GogAxis *axis)
 }
 
 GogColorScale *
-_gog_axis_get_color_scale (GogAxis *axis)
+gog_axis_get_color_scale (GogAxis *axis)
 {
        g_return_val_if_fail (GOG_IS_AXIS (axis), NULL);
 
diff --git a/goffice/graph/gog-axis.h b/goffice/graph/gog-axis.h
index e582d86..2cc1fd1 100644
--- a/goffice/graph/gog-axis.h
+++ b/goffice/graph/gog-axis.h
@@ -110,9 +110,9 @@ GogAxisPolarUnit    gog_axis_get_polar_unit         (GogAxis *axis);
 double                         gog_axis_get_polar_perimeter    (GogAxis *axis);
 double                         gog_axis_get_circular_rotation  (GogAxis *axis);
 GogAxisColorMap const *gog_axis_get_color_map  (GogAxis *axis);
+GogColorScale *gog_axis_get_color_scale (GogAxis *axis);
 
 /* private */
-GogColorScale *_gog_axis_get_color_scale (GogAxis *axis);
 void _gog_axis_set_color_scale (GogAxis *axis, GogColorScale *scale);
 
 G_END_DECLS
diff --git a/goffice/graph/gog-chart.c b/goffice/graph/gog-chart.c
index ae9e000..ae19b90 100644
--- a/goffice/graph/gog-chart.c
+++ b/goffice/graph/gog-chart.c
@@ -558,7 +558,7 @@ axis_pre_remove (GogObject *parent, GogObject *child)
 {
        GogChart *chart = GOG_CHART (parent);
        GogAxis *axis = GOG_AXIS (child);
-       GogColorScale *scale = _gog_axis_get_color_scale (axis);
+       GogColorScale *scale = gog_axis_get_color_scale (axis);
        if (scale)
                gog_color_scale_set_axis (scale, NULL);
        gog_axis_clear_contributors (GOG_AXIS (axis));
@@ -581,7 +581,7 @@ color_scale_can_add (GogObject const *parent)
                axis = GOG_AXIS (ptr->data);
                type = gog_axis_get_atype (axis);
                if ((type == GOG_AXIS_COLOR || type == GOG_AXIS_PSEUDO_3D)
-                   && _gog_axis_get_color_scale (axis) == NULL)
+                   && gog_axis_get_color_scale (axis) == NULL)
                        return TRUE;
        }
        return FALSE;
@@ -595,23 +595,31 @@ color_scale_post_add (GogObject *parent, GogObject *child)
        GSList *ptr;
        GogAxis *axis;
        GogAxisType type;
+       GSList const *l;
 
        for (ptr = chart->axes; ptr && ptr->data; ptr = ptr->next) {
                axis = GOG_AXIS (ptr->data);
                type = gog_axis_get_atype (axis);
                if ((type == GOG_AXIS_COLOR || type == GOG_AXIS_PSEUDO_3D)
-                   && _gog_axis_get_color_scale (axis) == NULL) {
+                   && gog_axis_get_color_scale (axis) == NULL) {
                                gog_color_scale_set_axis (GOG_COLOR_SCALE (child), axis);
+                               for (l = gog_axis_contributors (axis); l; l = l->next)
+                                       gog_object_request_update (GOG_OBJECT (l->data));
                                break;
                        }
        }
+       gog_chart_request_cardinality_update (chart);
 }
 
 static void
 color_scale_pre_remove (GogObject *parent, GogObject *scale)
 {
        /* Unlink the color scale */
+       GSList const *l = gog_axis_contributors (gog_color_scale_get_axis (GOG_COLOR_SCALE (scale)));
        gog_color_scale_set_axis (GOG_COLOR_SCALE (scale), NULL);
+       for (; l; l = l->next)
+               gog_object_request_update (GOG_OBJECT (l->data));
+       gog_chart_request_cardinality_update (GOG_CHART (parent));
 }
 
 
diff --git a/goffice/graph/gog-renderer.c b/goffice/graph/gog-renderer.c
index bd768a0..b5c2532 100644
--- a/goffice/graph/gog-renderer.c
+++ b/goffice/graph/gog-renderer.c
@@ -428,7 +428,7 @@ _draw_shape (GogRenderer *renderer, GOPath const *path, gboolean fill, gboolean
        g_return_if_fail (renderer->cur_style != NULL);
        g_return_if_fail (GO_IS_PATH (path));
 
-        style = renderer->cur_style;
+    style = renderer->cur_style;
 
        line_options = go_path_get_options (path);
        width = stroke ? _grc_line_size (renderer, style->line.width,
diff --git a/plugins/plot_surface/Makefile.am b/plugins/plot_surface/Makefile.am
index 40c6fc4..a2813e2 100644
--- a/plugins/plot_surface/Makefile.am
+++ b/plugins/plot_surface/Makefile.am
@@ -10,6 +10,8 @@ surface_la_SOURCES = \
        gog-xyz.h               \
        gog-contour.c           \
        gog-contour.h           \
+       gog-matrix.c            \
+       gog-matrix.h            \
        gog-surface.c           \
        gog-surface.h           \
        gog-xyz-surface.c       \
@@ -28,7 +30,7 @@ surface_la_SOURCES += \
        gog-xyz-surface-prefs.c
 endif
 
-plugin_resources = contour.xpm surface.xpm
+plugin_resources = contour.xpm matrix.xpm surface.xpm
 pofiles = $(wildcard $(top_srcdir)/po/*.po)
 
 plugin.xml: plugin.xml.in $(plugin_resources) $(pofiles) $(top_srcdir)/tools/resource-embedder
@@ -45,8 +47,13 @@ plot-types.xml : plot-types.xml.in
 embedded_stuff_raw = \
        chart_contour_1_1.png   \
        chart_contour_2_1.png   \
+       chart_contour_2_2.png   \
+       chart_matrix_1_1.png    \
+       chart_matrix_1_2.png    \
+       chart_matrix_1_3.png    \
        chart_surface_2_1.png   \
-       chart_surface_2_2.png
+       chart_surface_2_2.png   \
+       chart_surface_2_3.png
 
 embedded_stuff_compress = \
        gog-xyz-prefs.ui        \
diff --git a/plugins/plot_surface/chart_contour_2_2.png b/plugins/plot_surface/chart_contour_2_2.png
new file mode 100644
index 0000000..5d71b63
Binary files /dev/null and b/plugins/plot_surface/chart_contour_2_2.png differ
diff --git a/plugins/plot_surface/chart_contour_2_2.svg b/plugins/plot_surface/chart_contour_2_2.svg
new file mode 100644
index 0000000..330fa47
--- /dev/null
+++ b/plugins/plot_surface/chart_contour_2_2.svg
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   id="svg1"
+   sodipodi:version="0.32"
+   inkscape:version="0.48.3.1 r9886"
+   width="64.000000mm"
+   height="60.000000mm"
+   sodipodi:docname="chart_contour_2_2.svg"
+   inkscape:export-filename="/home/jean/devel/goffice/plugins/plot_surface/chart_contour_2_2.png"
+   inkscape:export-xdpi="25.4"
+   inkscape:export-ydpi="25.4"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   version="1.1">
+  <defs
+     id="defs3">
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 106.29921 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="226.77165 : 106.29921 : 1"
+       inkscape:persp3d-origin="113.38583 : 70.86614 : 1"
+       id="perspective3158" />
+    <linearGradient
+       id="linearGradient4044">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.0000000;"
+         offset="0.0000000"
+         id="stop4045" />
+      <stop
+         style="stop-color:#363636;stop-opacity:0.18750000;"
+         offset="1.0000000"
+         id="stop4046" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3418">
+      <stop
+         style="stop-color:#f7f7f7;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop3419" />
+      <stop
+         style="stop-color:#dedede;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop3420" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2791">
+      <stop
+         style="stop-color:#fbfbfb;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop2792" />
+      <stop
+         style="stop-color:#e9e9e9;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop2793" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2791"
+       id="linearGradient2794"
+       x1="0.49693251"
+       y1="0.058441557"
+       x2="0.49079755"
+       y2="0.96103895" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3418"
+       id="linearGradient3417"
+       x1="0.53846157"
+       y1="0.012987013"
+       x2="0.53254437"
+       y2="0.98051947" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4044"
+       id="linearGradient4043"
+       x1="0.49689442"
+       y1="0.012987013"
+       x2="0.49689442"
+       y2="0.99350649" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0000000"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2.5352964"
+     inkscape:cx="113.38583"
+     inkscape:cy="106.29921"
+     inkscape:window-width="1600"
+     inkscape:window-height="848"
+     showborder="true"
+     showgrid="true"
+     inkscape:grid-points="true"
+     inkscape:grid-bbox="true"
+     gridtolerance="1.0000000px"
+     inkscape:guide-bbox="true"
+     inkscape:guide-points="true"
+     guidetolerance="1.0000000mm"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     showguides="true"
+     inkscape:current-layer="svg1"
+     inkscape:window-maximized="1">
+    <sodipodi:guide
+       orientation="vertical"
+       position="23.994627"
+       id="guide5924" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="58.080453"
+       id="guide5925" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="92.166278"
+       id="guide5926" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="126.25210"
+       id="guide5927" />
+    <inkscape:grid
+       id="GridFromPre046Settings"
+       type="xygrid"
+       originx="0px"
+       originy="0.50000000mm"
+       spacingx="1.0000000mm"
+       spacingy="1.0000000mm"
+       color="#0000ff"
+       empcolor="#0000ff"
+       opacity="0.2"
+       empopacity="0.4"
+       empspacing="5" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata4">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect4047"
+     width="184.25197"
+     height="177.15660"
+     x="23.031496"
+     y="23.040251"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3421"
+     width="177.16536"
+     height="173.62204"
+     x="26.574802"
+     y="23.031490"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient2794);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect2169"
+     width="170.38249"
+     height="159.80026"
+     x="30.118111"
+     y="26.554472"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient3417);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3416"
+     width="163.39728"
+     height="149.19994"
+     x="31.955462"
+     y="31.699234"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:#c5d2c8;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect386"
+     width="170.38249"
+     height="159.80026"
+     x="29.993284"
+     y="26.574797"
+     rx="17.594519"
+     ry="14.164467" />
+  <path
+     
style="fill:#83a67f;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.7750000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;"
+     d="M 47.593750,26.562500 C 37.846387,26.562500 30.000000,32.902883 30.000000,40.750000 L 
30.000000,157.31250 C 30.006008,157.31920 30.121170,157.68750 30.125000,157.68750 L 65.562500,148.31250 L 
120.31250,93.906250 L 114.00000,28.000000 C 114.00000,28.000000 111.27000,26.882252 110.56250,26.562500 L 
47.593750,26.562500 z "
+     id="path13"
+     sodipodi:nodetypes="ccccccccc" />
+  <path
+     
style="fill:#d1940c;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.7750000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;"
+     d="M 47.593750,26.562500 C 37.846387,26.562500 30.000000,32.902883 30.000000,40.750000 L 
30.000000,95.031250 C 30.005058,95.045916 30.125000,95.437500 30.125000,95.437500 L 76.187500,83.281250 L 
80.187500,26.562500 L 47.593750,26.562500 z "
+     id="path12"
+     sodipodi:nodetypes="ccccccc" />
+  <path
+     
style="fill:#83a67f;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.7750000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;"
+     d="M 180.40625,26.562500 C 180.26064,26.680328 179.46875,27.218750 179.46875,27.218750 L 
149.50000,122.25000 L 69.093750,186.03125 C 68.976443,186.05329 70.037845,186.29787 70.187500,186.37500 L 
182.78125,186.37500 C 192.52861,186.37500 200.37500,180.06587 200.37500,172.21875 L 200.37500,40.750000 C 
200.37500,32.902885 192.52862,26.562500 182.78125,26.562500 L 180.40625,26.562500 z "
+     id="path15"
+     sodipodi:nodetypes="cccccccccc" />
+  <path
+     
style="fill:#d1940c;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.7750000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;stroke-miterlimit:4.0000000;stroke-dasharray:none;"
+     d="M 200.18750,123.84375 L 155.81250,145.93750 L 143.96875,185.78125 C 143.96875,185.78125 
145.28255,186.27152 145.53125,186.37500 L 182.78125,186.37500 C 192.52861,186.37500 200.37500,180.06587 
200.37500,172.21875 L 200.37500,123.96875 C 200.32000,123.94859 200.23799,123.84375 200.18750,123.84375 z "
+     id="path14"
+     sodipodi:nodetypes="cccccccc" />
+  <rect
+     
style="fill:none;fill-opacity:1.0;fill-rule:evenodd;stroke:#000000;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect5928"
+     width="170.38249"
+     height="159.80026"
+     x="29.993284"
+     y="26.574797"
+     rx="17.594519"
+     ry="14.164467" />
+  <text
+     xml:space="preserve"
+     
style="font-size:32px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation
 Serif"
+     x="69.718872"
+     y="165.17741"
+     id="text2350"><tspan
+       sodipodi:role="line"
+       id="tspan2352"
+       x="69.718872"
+       y="165.17741">XY</tspan></text>
+</svg>
diff --git a/plugins/plot_surface/chart_matrix_1_1.png b/plugins/plot_surface/chart_matrix_1_1.png
new file mode 100644
index 0000000..1be1650
Binary files /dev/null and b/plugins/plot_surface/chart_matrix_1_1.png differ
diff --git a/plugins/plot_surface/chart_matrix_1_1.svg b/plugins/plot_surface/chart_matrix_1_1.svg
new file mode 100644
index 0000000..0099988
--- /dev/null
+++ b/plugins/plot_surface/chart_matrix_1_1.svg
@@ -0,0 +1,533 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   id="svg1"
+   sodipodi:version="0.32"
+   inkscape:version="0.48.3.1 r9886"
+   width="64.000000mm"
+   height="60.000000mm"
+   sodipodi:docname="chart_matrix_1_1.svg"
+   version="1.1"
+   inkscape:export-filename="/home/jean/devel/goffice/plugins/plot_surface/chart_matrix_1_1.png"
+   inkscape:export-xdpi="25.4"
+   inkscape:export-ydpi="25.4">
+  <defs
+     id="defs3">
+    <linearGradient
+       id="linearGradient4044">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.0000000;"
+         offset="0.0000000"
+         id="stop4045" />
+      <stop
+         style="stop-color:#363636;stop-opacity:0.18750000;"
+         offset="1.0000000"
+         id="stop4046" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3418">
+      <stop
+         style="stop-color:#f7f7f7;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop3419" />
+      <stop
+         style="stop-color:#dedede;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop3420" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2791">
+      <stop
+         style="stop-color:#fbfbfb;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop2792" />
+      <stop
+         style="stop-color:#e9e9e9;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop2793" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2791"
+       id="linearGradient2794"
+       x1="0.49693251"
+       y1="0.058441557"
+       x2="0.49079755"
+       y2="0.96103895" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3418"
+       id="linearGradient3417"
+       x1="0.53846157"
+       y1="0.012987013"
+       x2="0.53254437"
+       y2="0.98051947" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4044"
+       id="linearGradient4043"
+       x1="0.49689442"
+       y1="0.012987013"
+       x2="0.49689442"
+       y2="0.99350649" />
+    <clipPath
+       id="clip1">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,190 62,190 l 0,45.67187 -46.894531,0 z"
+         id="path3283" />
+    </clipPath>
+    <clipPath
+       id="clip2">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,144 62,144 l 0,47 -46.894531,0 z"
+         id="path3286" />
+    </clipPath>
+    <clipPath
+       id="clip3">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,99 62,99 l 0,46 -46.894531,0 z"
+         id="path3289" />
+    </clipPath>
+    <clipPath
+       id="clip4">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,54 62,54 l 0,46 -46.894531,0 z"
+         id="path3292" />
+    </clipPath>
+    <clipPath
+       id="clip5">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,8.949219 62,8.949219 62,55 15.105469,55 z"
+         id="path3295" />
+    </clipPath>
+    <clipPath
+       id="clip6">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 61,190 48,0 0,45.67187 -48,0 z"
+         id="path3298" />
+    </clipPath>
+    <clipPath
+       id="clip7">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 61,8.949219 48,0 L 109,55 61,55 z"
+         id="path3301" />
+    </clipPath>
+    <clipPath
+       id="clip8">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 108,190 47,0 0,45.67187 -47,0 z"
+         id="path3304" />
+    </clipPath>
+    <clipPath
+       id="clip9">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 108,8.949219 47,0 L 155,55 108,55 z"
+         id="path3307" />
+    </clipPath>
+    <clipPath
+       id="clip10">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 154,190 48,0 0,45.67187 -48,0 z"
+         id="path3310" />
+    </clipPath>
+    <clipPath
+       id="clip11">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 154,8.949219 48,0 L 202,55 154,55 z"
+         id="path3313" />
+    </clipPath>
+    <clipPath
+       id="clip12">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,190 47.16016,0 0,45.67187 -47.16016,0 z"
+         id="path3316" />
+    </clipPath>
+    <clipPath
+       id="clip13">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,144 47.16016,0 0,47 L 201,191 z"
+         id="path3319" />
+    </clipPath>
+    <clipPath
+       id="clip14">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,99 47.16016,0 0,46 L 201,145 z"
+         id="path3322" />
+    </clipPath>
+    <clipPath
+       id="clip15">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,54 47.16016,0 0,46 L 201,100 z"
+         id="path3325" />
+    </clipPath>
+    <clipPath
+       id="clip16">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,8.949219 47.16016,0 0,46.050781 L 201,55 z"
+         id="path3328" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4169">
+      <rect
+         
style="fill:none;stroke:#000000;stroke-width:4.98070908;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
+         id="rect4171"
+         width="235.68428"
+         height="230.47493"
+         x="14.80587"
+         y="7.0255532"
+         rx="24.337896"
+         ry="20.428968" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0000000"
+     inkscape:pageshadow="2"
+     inkscape:zoom="3.1532236"
+     inkscape:cx="189.35819"
+     inkscape:cy="128.61729"
+     inkscape:window-width="1270"
+     inkscape:window-height="844"
+     showborder="true"
+     showgrid="true"
+     inkscape:grid-points="true"
+     inkscape:grid-bbox="true"
+     gridtolerance="1.0000000px"
+     inkscape:guide-bbox="true"
+     inkscape:guide-points="true"
+     guidetolerance="1.0000000mm"
+     inkscape:window-x="287"
+     inkscape:window-y="27"
+     showguides="true"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg1">
+    <sodipodi:guide
+       orientation="vertical"
+       position="23.994627"
+       id="guide5924" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="58.080453"
+       id="guide5925" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="92.166278"
+       id="guide5926" />
+    <sodipodi:guide
+       orientation="-0.99999906,0.0013717695"
+       position="126.25210"
+       id="guide5927" />
+    <inkscape:grid
+       id="GridFromPre046Settings"
+       type="xygrid"
+       originx="0.50000000mm"
+       originy="0.50000000mm"
+       spacingx="1.0000000mm"
+       spacingy="1.0000000mm"
+       color="#3f3fff"
+       empcolor="#3f3fff"
+       opacity="0.15"
+       empopacity="0.38"
+       empspacing="5" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata4">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect4047"
+     width="184.25197"
+     height="177.15660"
+     x="23.031496"
+     y="23.040251"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3421"
+     width="177.16536"
+     height="173.62204"
+     x="26.574802"
+     y="23.031490"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient2794);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect2169"
+     width="170.38249"
+     height="159.80026"
+     x="30.118111"
+     y="26.554472"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient3417);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3416"
+     width="163.39728"
+     height="149.19994"
+     x="31.955462"
+     y="31.699234"
+     rx="17.594519"
+     ry="14.164467" />
+  <g
+     id="g4173"
+     transform="matrix(1,0,0,-1,0,213.01576)">
+    <g
+       clip-path="url(#clipPath4169)"
+       id="g3539"
+       transform="matrix(0.72292682,0,0,0.69335203,19.888757,21.703615)">
+      <g
+         id="g3333"
+         clip-rule="nonzero"
+         clip-path="url(#clip1)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3335"
+           d="m 15.105469,235.67187 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3337"
+         clip-rule="nonzero"
+         clip-path="url(#clip2)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3339"
+           d="m 15.105469,190.32812 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#00e3ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3341"
+         clip-rule="nonzero"
+         clip-path="url(#clip3)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3343"
+           d="m 15.105469,144.98437 46.609375,0 0,-45.347651 -46.609375,0 z"
+           style="fill:#00ff33;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3345"
+         clip-rule="nonzero"
+         clip-path="url(#clip4)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3347"
+           d="m 15.105469,99.636719 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#57ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3349"
+         clip-rule="nonzero"
+         clip-path="url(#clip5)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3351"
+           d="m 15.105469,54.292969 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#ccff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3353"
+         clip-rule="nonzero"
+         clip-path="url(#clip6)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3355"
+           d="m 61.714844,235.67187 46.613286,0 0,-45.34375 -46.613286,0 z"
+           style="fill:#0099ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3357"
+         d="m 61.714844,190.32812 46.613286,0 0,-45.34375 -46.613286,0 z"
+         style="fill:#00ff7f;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3359"
+         d="m 61.714844,144.98437 46.613286,0 0,-45.347651 -46.613286,0 z"
+         style="fill:#33ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3361"
+         d="m 61.714844,99.636719 46.613286,0 0,-45.34375 -46.613286,0 z"
+         style="fill:#a6ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3363"
+         clip-rule="nonzero"
+         clip-path="url(#clip7)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3365"
+           d="m 61.714844,54.292969 46.613286,0 0,-45.34375 -46.613286,0 z"
+           style="fill:#ffe600;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3367"
+         clip-rule="nonzero"
+         clip-path="url(#clip8)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3369"
+           d="m 108.32813,235.67187 46.60937,0 0,-45.34375 -46.60937,0 z"
+           style="fill:#00ffcc;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3371"
+         d="m 108.32813,190.32812 46.60937,0 0,-45.34375 -46.60937,0 z"
+         style="fill:#0cff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3373"
+         d="m 108.32813,144.98437 46.60937,0 0,-45.347651 -46.60937,0 z"
+         style="fill:#7dff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3375"
+         d="m 108.32813,99.636719 46.60937,0 0,-45.34375 -46.60937,0 z"
+         style="fill:#f0ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3377"
+         clip-rule="nonzero"
+         clip-path="url(#clip9)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3379"
+           d="m 108.32813,54.292969 46.60937,0 0,-45.34375 -46.60937,0 z"
+           style="fill:#ff9900;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3381"
+         clip-rule="nonzero"
+         clip-path="url(#clip10)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3383"
+           d="m 154.9375,235.67187 46.61328,0 0,-45.34375 -46.61328,0 z"
+           style="fill:#00ff33;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3385"
+         d="m 154.9375,190.32812 46.61328,0 0,-45.34375 -46.61328,0 z"
+         style="fill:#57ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3387"
+         d="m 154.9375,144.98437 46.61328,0 0,-45.347651 -46.61328,0 z"
+         style="fill:#ccff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3389"
+         d="m 154.9375,99.636719 46.61328,0 0,-45.34375 -46.61328,0 z"
+         style="fill:#ffbd00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3391"
+         clip-rule="nonzero"
+         clip-path="url(#clip11)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3393"
+           d="m 154.9375,54.292969 46.61328,0 0,-45.34375 -46.61328,0 z"
+           style="fill:#ff4a00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3395"
+         clip-rule="nonzero"
+         clip-path="url(#clip12)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3397"
+           d="m 201.55078,235.67187 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#33ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3399"
+         clip-rule="nonzero"
+         clip-path="url(#clip13)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3401"
+           d="m 201.55078,190.32812 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#a6ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3403"
+         clip-rule="nonzero"
+         clip-path="url(#clip14)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3405"
+           d="m 201.55078,144.98437 46.60938,0 0,-45.347651 -46.60938,0 z"
+           style="fill:#ffe300;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3407"
+         clip-rule="nonzero"
+         clip-path="url(#clip15)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3409"
+           d="m 201.55078,99.636719 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#ff7300;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3411"
+         clip-rule="nonzero"
+         clip-path="url(#clip16)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3413"
+           d="m 201.55078,54.292969 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+    </g>
+  </g>
+  <rect
+     
style="fill:none;fill-opacity:0.74901998;fill-rule:evenodd;stroke:#000000;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect5928"
+     width="170.38249"
+     height="159.80026"
+     x="29.993284"
+     y="26.574797"
+     rx="17.594519"
+     ry="14.164467" />
+</svg>
diff --git a/plugins/plot_surface/chart_matrix_1_2.png b/plugins/plot_surface/chart_matrix_1_2.png
new file mode 100644
index 0000000..00841c9
Binary files /dev/null and b/plugins/plot_surface/chart_matrix_1_2.png differ
diff --git a/plugins/plot_surface/chart_matrix_1_2.svg b/plugins/plot_surface/chart_matrix_1_2.svg
new file mode 100644
index 0000000..108edf4
--- /dev/null
+++ b/plugins/plot_surface/chart_matrix_1_2.svg
@@ -0,0 +1,543 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   id="svg1"
+   sodipodi:version="0.32"
+   inkscape:version="0.48.3.1 r9886"
+   width="64.000000mm"
+   height="60.000000mm"
+   sodipodi:docname="chart_matrix_1_2.svg"
+   version="1.1"
+   inkscape:export-filename="/home/jean/devel/goffice/plugins/plot_surface/chart_matrix_1_2.png"
+   inkscape:export-xdpi="25.4"
+   inkscape:export-ydpi="25.4">
+  <defs
+     id="defs3">
+    <linearGradient
+       id="linearGradient4044">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.0000000;"
+         offset="0.0000000"
+         id="stop4045" />
+      <stop
+         style="stop-color:#363636;stop-opacity:0.18750000;"
+         offset="1.0000000"
+         id="stop4046" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3418">
+      <stop
+         style="stop-color:#f7f7f7;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop3419" />
+      <stop
+         style="stop-color:#dedede;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop3420" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2791">
+      <stop
+         style="stop-color:#fbfbfb;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop2792" />
+      <stop
+         style="stop-color:#e9e9e9;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop2793" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2791"
+       id="linearGradient2794"
+       x1="0.49693251"
+       y1="0.058441557"
+       x2="0.49079755"
+       y2="0.96103895" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3418"
+       id="linearGradient3417"
+       x1="0.53846157"
+       y1="0.012987013"
+       x2="0.53254437"
+       y2="0.98051947" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4044"
+       id="linearGradient4043"
+       x1="0.49689442"
+       y1="0.012987013"
+       x2="0.49689442"
+       y2="0.99350649" />
+    <clipPath
+       id="clip1">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,190 62,190 l 0,45.67187 -46.894531,0 z"
+         id="path3283" />
+    </clipPath>
+    <clipPath
+       id="clip2">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,144 62,144 l 0,47 -46.894531,0 z"
+         id="path3286" />
+    </clipPath>
+    <clipPath
+       id="clip3">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,99 62,99 l 0,46 -46.894531,0 z"
+         id="path3289" />
+    </clipPath>
+    <clipPath
+       id="clip4">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,54 62,54 l 0,46 -46.894531,0 z"
+         id="path3292" />
+    </clipPath>
+    <clipPath
+       id="clip5">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,8.949219 62,8.949219 62,55 15.105469,55 z"
+         id="path3295" />
+    </clipPath>
+    <clipPath
+       id="clip6">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 61,190 48,0 0,45.67187 -48,0 z"
+         id="path3298" />
+    </clipPath>
+    <clipPath
+       id="clip7">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 61,8.949219 48,0 L 109,55 61,55 z"
+         id="path3301" />
+    </clipPath>
+    <clipPath
+       id="clip8">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 108,190 47,0 0,45.67187 -47,0 z"
+         id="path3304" />
+    </clipPath>
+    <clipPath
+       id="clip9">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 108,8.949219 47,0 L 155,55 108,55 z"
+         id="path3307" />
+    </clipPath>
+    <clipPath
+       id="clip10">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 154,190 48,0 0,45.67187 -48,0 z"
+         id="path3310" />
+    </clipPath>
+    <clipPath
+       id="clip11">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 154,8.949219 48,0 L 202,55 154,55 z"
+         id="path3313" />
+    </clipPath>
+    <clipPath
+       id="clip12">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,190 47.16016,0 0,45.67187 -47.16016,0 z"
+         id="path3316" />
+    </clipPath>
+    <clipPath
+       id="clip13">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,144 47.16016,0 0,47 L 201,191 z"
+         id="path3319" />
+    </clipPath>
+    <clipPath
+       id="clip14">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,99 47.16016,0 0,46 L 201,145 z"
+         id="path3322" />
+    </clipPath>
+    <clipPath
+       id="clip15">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,54 47.16016,0 0,46 L 201,100 z"
+         id="path3325" />
+    </clipPath>
+    <clipPath
+       id="clip16">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,8.949219 47.16016,0 0,46.050781 L 201,55 z"
+         id="path3328" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4169">
+      <rect
+         
style="fill:none;stroke:#000000;stroke-width:4.98070908;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
+         id="rect4171"
+         width="235.68428"
+         height="230.47493"
+         x="14.80587"
+         y="7.0255532"
+         rx="24.337896"
+         ry="20.428968" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0000000"
+     inkscape:pageshadow="2"
+     inkscape:zoom="3.1532236"
+     inkscape:cx="189.99246"
+     inkscape:cy="128.61729"
+     inkscape:window-width="1270"
+     inkscape:window-height="844"
+     showborder="true"
+     showgrid="true"
+     inkscape:grid-points="true"
+     inkscape:grid-bbox="true"
+     gridtolerance="1.0000000px"
+     inkscape:guide-bbox="true"
+     inkscape:guide-points="true"
+     guidetolerance="1.0000000mm"
+     inkscape:window-x="160"
+     inkscape:window-y="27"
+     showguides="true"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg1">
+    <sodipodi:guide
+       orientation="vertical"
+       position="23.994627"
+       id="guide5924" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="58.080453"
+       id="guide5925" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="92.166278"
+       id="guide5926" />
+    <sodipodi:guide
+       orientation="-0.99999906,0.0013717695"
+       position="126.25210"
+       id="guide5927" />
+    <inkscape:grid
+       id="GridFromPre046Settings"
+       type="xygrid"
+       originx="0.50000000mm"
+       originy="0.50000000mm"
+       spacingx="1.0000000mm"
+       spacingy="1.0000000mm"
+       color="#3f3fff"
+       empcolor="#3f3fff"
+       opacity="0.15"
+       empopacity="0.38"
+       empspacing="5" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata4">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect4047"
+     width="184.25197"
+     height="177.15660"
+     x="23.031496"
+     y="23.040251"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3421"
+     width="177.16536"
+     height="173.62204"
+     x="26.574802"
+     y="23.031490"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient2794);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect2169"
+     width="170.38249"
+     height="159.80026"
+     x="30.118111"
+     y="26.554472"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient3417);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3416"
+     width="163.39728"
+     height="149.19994"
+     x="31.955462"
+     y="31.699234"
+     rx="17.594519"
+     ry="14.164467" />
+  <g
+     id="g4173"
+     transform="matrix(1,0,0,-1,0,213.01576)">
+    <g
+       clip-path="url(#clipPath4169)"
+       id="g3539"
+       transform="matrix(0.72292682,0,0,0.69335203,19.888757,21.703615)">
+      <g
+         id="g3333"
+         clip-rule="nonzero"
+         clip-path="url(#clip1)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3335"
+           d="m 15.105469,235.67187 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3337"
+         clip-rule="nonzero"
+         clip-path="url(#clip2)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3339"
+           d="m 15.105469,190.32812 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#00e3ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3341"
+         clip-rule="nonzero"
+         clip-path="url(#clip3)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3343"
+           d="m 15.105469,144.98437 46.609375,0 0,-45.347651 -46.609375,0 z"
+           style="fill:#00ff33;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3345"
+         clip-rule="nonzero"
+         clip-path="url(#clip4)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3347"
+           d="m 15.105469,99.636719 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#57ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3349"
+         clip-rule="nonzero"
+         clip-path="url(#clip5)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3351"
+           d="m 15.105469,54.292969 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#ccff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3353"
+         clip-rule="nonzero"
+         clip-path="url(#clip6)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3355"
+           d="m 61.714844,235.67187 46.613286,0 0,-45.34375 -46.613286,0 z"
+           style="fill:#0099ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3357"
+         d="m 61.714844,190.32812 46.613286,0 0,-45.34375 -46.613286,0 z"
+         style="fill:#00ff7f;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3359"
+         d="m 61.714844,144.98437 46.613286,0 0,-45.347651 -46.613286,0 z"
+         style="fill:#33ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3361"
+         d="m 61.714844,99.636719 46.613286,0 0,-45.34375 -46.613286,0 z"
+         style="fill:#a6ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3363"
+         clip-rule="nonzero"
+         clip-path="url(#clip7)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3365"
+           d="m 61.714844,54.292969 46.613286,0 0,-45.34375 -46.613286,0 z"
+           style="fill:#ffe600;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3367"
+         clip-rule="nonzero"
+         clip-path="url(#clip8)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3369"
+           d="m 108.32813,235.67187 46.60937,0 0,-45.34375 -46.60937,0 z"
+           style="fill:#00ffcc;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3371"
+         d="m 108.32813,190.32812 46.60937,0 0,-45.34375 -46.60937,0 z"
+         style="fill:#0cff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3373"
+         d="m 108.32813,144.98437 46.60937,0 0,-45.347651 -46.60937,0 z"
+         style="fill:#7dff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3375"
+         d="m 108.32813,99.636719 46.60937,0 0,-45.34375 -46.60937,0 z"
+         style="fill:#f0ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3377"
+         clip-rule="nonzero"
+         clip-path="url(#clip9)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3379"
+           d="m 108.32813,54.292969 46.60937,0 0,-45.34375 -46.60937,0 z"
+           style="fill:#ff9900;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3381"
+         clip-rule="nonzero"
+         clip-path="url(#clip10)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3383"
+           d="m 154.9375,235.67187 46.61328,0 0,-45.34375 -46.61328,0 z"
+           style="fill:#00ff33;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3385"
+         d="m 154.9375,190.32812 46.61328,0 0,-45.34375 -46.61328,0 z"
+         style="fill:#57ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3387"
+         d="m 154.9375,144.98437 46.61328,0 0,-45.347651 -46.61328,0 z"
+         style="fill:#ccff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3389"
+         d="m 154.9375,99.636719 46.61328,0 0,-45.34375 -46.61328,0 z"
+         style="fill:#ffbd00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3391"
+         clip-rule="nonzero"
+         clip-path="url(#clip11)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3393"
+           d="m 154.9375,54.292969 46.61328,0 0,-45.34375 -46.61328,0 z"
+           style="fill:#ff4a00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3395"
+         clip-rule="nonzero"
+         clip-path="url(#clip12)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3397"
+           d="m 201.55078,235.67187 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#33ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3399"
+         clip-rule="nonzero"
+         clip-path="url(#clip13)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3401"
+           d="m 201.55078,190.32812 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#a6ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3403"
+         clip-rule="nonzero"
+         clip-path="url(#clip14)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3405"
+           d="m 201.55078,144.98437 46.60938,0 0,-45.347651 -46.60938,0 z"
+           style="fill:#ffe300;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3407"
+         clip-rule="nonzero"
+         clip-path="url(#clip15)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3409"
+           d="m 201.55078,99.636719 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#ff7300;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3411"
+         clip-rule="nonzero"
+         clip-path="url(#clip16)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3413"
+           d="m 201.55078,54.292969 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+    </g>
+  </g>
+  <rect
+     
style="fill:none;fill-opacity:0.74901998;fill-rule:evenodd;stroke:#000000;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect5928"
+     width="170.38249"
+     height="159.80026"
+     x="29.993284"
+     y="26.574797"
+     rx="17.594519"
+     ry="14.164467" />
+  <text
+     xml:space="preserve"
+     
style="font-size:32px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation
 Serif"
+     x="79.500122"
+     y="165.17741"
+     id="text2350"><tspan
+       sodipodi:role="line"
+       id="tspan2352"
+       x="79.500122"
+       y="165.17741">XYZ</tspan></text>
+</svg>
diff --git a/plugins/plot_surface/chart_matrix_1_3.png b/plugins/plot_surface/chart_matrix_1_3.png
new file mode 100644
index 0000000..3a78e25
Binary files /dev/null and b/plugins/plot_surface/chart_matrix_1_3.png differ
diff --git a/plugins/plot_surface/chart_matrix_1_3.svg b/plugins/plot_surface/chart_matrix_1_3.svg
new file mode 100644
index 0000000..2e52645
--- /dev/null
+++ b/plugins/plot_surface/chart_matrix_1_3.svg
@@ -0,0 +1,543 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   id="svg1"
+   sodipodi:version="0.32"
+   inkscape:version="0.48.3.1 r9886"
+   width="64.000000mm"
+   height="60.000000mm"
+   sodipodi:docname="chart_matrix_1_3.svg"
+   version="1.1"
+   inkscape:export-filename="/home/jean/devel/goffice/plugins/plot_surface/chart_matrix_1_3.png"
+   inkscape:export-xdpi="25.4"
+   inkscape:export-ydpi="25.4">
+  <defs
+     id="defs3">
+    <linearGradient
+       id="linearGradient4044">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.0000000;"
+         offset="0.0000000"
+         id="stop4045" />
+      <stop
+         style="stop-color:#363636;stop-opacity:0.18750000;"
+         offset="1.0000000"
+         id="stop4046" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3418">
+      <stop
+         style="stop-color:#f7f7f7;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop3419" />
+      <stop
+         style="stop-color:#dedede;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop3420" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2791">
+      <stop
+         style="stop-color:#fbfbfb;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop2792" />
+      <stop
+         style="stop-color:#e9e9e9;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop2793" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2791"
+       id="linearGradient2794"
+       x1="0.49693251"
+       y1="0.058441557"
+       x2="0.49079755"
+       y2="0.96103895" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3418"
+       id="linearGradient3417"
+       x1="0.53846157"
+       y1="0.012987013"
+       x2="0.53254437"
+       y2="0.98051947" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4044"
+       id="linearGradient4043"
+       x1="0.49689442"
+       y1="0.012987013"
+       x2="0.49689442"
+       y2="0.99350649" />
+    <clipPath
+       id="clip1">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,190 62,190 l 0,45.67187 -46.894531,0 z"
+         id="path3283" />
+    </clipPath>
+    <clipPath
+       id="clip2">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,144 62,144 l 0,47 -46.894531,0 z"
+         id="path3286" />
+    </clipPath>
+    <clipPath
+       id="clip3">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,99 62,99 l 0,46 -46.894531,0 z"
+         id="path3289" />
+    </clipPath>
+    <clipPath
+       id="clip4">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,54 62,54 l 0,46 -46.894531,0 z"
+         id="path3292" />
+    </clipPath>
+    <clipPath
+       id="clip5">
+      <path
+         inkscape:connector-curvature="0"
+         d="M 15.105469,8.949219 62,8.949219 62,55 15.105469,55 z"
+         id="path3295" />
+    </clipPath>
+    <clipPath
+       id="clip6">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 61,190 48,0 0,45.67187 -48,0 z"
+         id="path3298" />
+    </clipPath>
+    <clipPath
+       id="clip7">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 61,8.949219 48,0 L 109,55 61,55 z"
+         id="path3301" />
+    </clipPath>
+    <clipPath
+       id="clip8">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 108,190 47,0 0,45.67187 -47,0 z"
+         id="path3304" />
+    </clipPath>
+    <clipPath
+       id="clip9">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 108,8.949219 47,0 L 155,55 108,55 z"
+         id="path3307" />
+    </clipPath>
+    <clipPath
+       id="clip10">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 154,190 48,0 0,45.67187 -48,0 z"
+         id="path3310" />
+    </clipPath>
+    <clipPath
+       id="clip11">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 154,8.949219 48,0 L 202,55 154,55 z"
+         id="path3313" />
+    </clipPath>
+    <clipPath
+       id="clip12">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,190 47.16016,0 0,45.67187 -47.16016,0 z"
+         id="path3316" />
+    </clipPath>
+    <clipPath
+       id="clip13">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,144 47.16016,0 0,47 L 201,191 z"
+         id="path3319" />
+    </clipPath>
+    <clipPath
+       id="clip14">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,99 47.16016,0 0,46 L 201,145 z"
+         id="path3322" />
+    </clipPath>
+    <clipPath
+       id="clip15">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,54 47.16016,0 0,46 L 201,100 z"
+         id="path3325" />
+    </clipPath>
+    <clipPath
+       id="clip16">
+      <path
+         inkscape:connector-curvature="0"
+         d="m 201,8.949219 47.16016,0 0,46.050781 L 201,55 z"
+         id="path3328" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath4169">
+      <rect
+         
style="fill:none;stroke:#000000;stroke-width:4.98070908;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
+         id="rect4171"
+         width="235.68428"
+         height="230.47493"
+         x="14.80587"
+         y="7.0255532"
+         rx="24.337896"
+         ry="20.428968" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0000000"
+     inkscape:pageshadow="2"
+     inkscape:zoom="3.1532236"
+     inkscape:cx="189.35819"
+     inkscape:cy="128.61729"
+     inkscape:window-width="1270"
+     inkscape:window-height="844"
+     showborder="true"
+     showgrid="true"
+     inkscape:grid-points="true"
+     inkscape:grid-bbox="true"
+     gridtolerance="1.0000000px"
+     inkscape:guide-bbox="true"
+     inkscape:guide-points="true"
+     guidetolerance="1.0000000mm"
+     inkscape:window-x="125"
+     inkscape:window-y="27"
+     showguides="true"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg1">
+    <sodipodi:guide
+       orientation="vertical"
+       position="23.994627"
+       id="guide5924" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="58.080453"
+       id="guide5925" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="92.166278"
+       id="guide5926" />
+    <sodipodi:guide
+       orientation="-0.99999906,0.0013717695"
+       position="126.25210"
+       id="guide5927" />
+    <inkscape:grid
+       id="GridFromPre046Settings"
+       type="xygrid"
+       originx="0.50000000mm"
+       originy="0.50000000mm"
+       spacingx="1.0000000mm"
+       spacingy="1.0000000mm"
+       color="#3f3fff"
+       empcolor="#3f3fff"
+       opacity="0.15"
+       empopacity="0.38"
+       empspacing="5" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata4">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect4047"
+     width="184.25197"
+     height="177.15660"
+     x="23.031496"
+     y="23.040251"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3421"
+     width="177.16536"
+     height="173.62204"
+     x="26.574802"
+     y="23.031490"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient2794);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect2169"
+     width="170.38249"
+     height="159.80026"
+     x="30.118111"
+     y="26.554472"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient3417);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3416"
+     width="163.39728"
+     height="149.19994"
+     x="31.955462"
+     y="31.699234"
+     rx="17.594519"
+     ry="14.164467" />
+  <g
+     id="g4173"
+     transform="matrix(1,0,0,-1,0,213.01576)">
+    <g
+       clip-path="url(#clipPath4169)"
+       id="g3539"
+       transform="matrix(0.72292682,0,0,0.69335203,19.888757,21.703615)">
+      <g
+         id="g3333"
+         clip-rule="nonzero"
+         clip-path="url(#clip1)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3335"
+           d="m 15.105469,235.67187 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#0000ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3337"
+         clip-rule="nonzero"
+         clip-path="url(#clip2)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3339"
+           d="m 15.105469,190.32812 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#00e3ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3341"
+         clip-rule="nonzero"
+         clip-path="url(#clip3)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3343"
+           d="m 15.105469,144.98437 46.609375,0 0,-45.347651 -46.609375,0 z"
+           style="fill:#00ff33;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3345"
+         clip-rule="nonzero"
+         clip-path="url(#clip4)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3347"
+           d="m 15.105469,99.636719 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#57ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3349"
+         clip-rule="nonzero"
+         clip-path="url(#clip5)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3351"
+           d="m 15.105469,54.292969 46.609375,0 0,-45.34375 -46.609375,0 z"
+           style="fill:#ccff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3353"
+         clip-rule="nonzero"
+         clip-path="url(#clip6)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3355"
+           d="m 61.714844,235.67187 46.613286,0 0,-45.34375 -46.613286,0 z"
+           style="fill:#0099ff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3357"
+         d="m 61.714844,190.32812 46.613286,0 0,-45.34375 -46.613286,0 z"
+         style="fill:#00ff7f;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3359"
+         d="m 61.714844,144.98437 46.613286,0 0,-45.347651 -46.613286,0 z"
+         style="fill:#33ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3361"
+         d="m 61.714844,99.636719 46.613286,0 0,-45.34375 -46.613286,0 z"
+         style="fill:#a6ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3363"
+         clip-rule="nonzero"
+         clip-path="url(#clip7)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3365"
+           d="m 61.714844,54.292969 46.613286,0 0,-45.34375 -46.613286,0 z"
+           style="fill:#ffe600;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3367"
+         clip-rule="nonzero"
+         clip-path="url(#clip8)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3369"
+           d="m 108.32813,235.67187 46.60937,0 0,-45.34375 -46.60937,0 z"
+           style="fill:#00ffcc;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3371"
+         d="m 108.32813,190.32812 46.60937,0 0,-45.34375 -46.60937,0 z"
+         style="fill:#0cff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3373"
+         d="m 108.32813,144.98437 46.60937,0 0,-45.347651 -46.60937,0 z"
+         style="fill:#7dff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3375"
+         d="m 108.32813,99.636719 46.60937,0 0,-45.34375 -46.60937,0 z"
+         style="fill:#f0ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3377"
+         clip-rule="nonzero"
+         clip-path="url(#clip9)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3379"
+           d="m 108.32813,54.292969 46.60937,0 0,-45.34375 -46.60937,0 z"
+           style="fill:#ff9900;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3381"
+         clip-rule="nonzero"
+         clip-path="url(#clip10)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3383"
+           d="m 154.9375,235.67187 46.61328,0 0,-45.34375 -46.61328,0 z"
+           style="fill:#00ff33;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <path
+         inkscape:connector-curvature="0"
+         id="path3385"
+         d="m 154.9375,190.32812 46.61328,0 0,-45.34375 -46.61328,0 z"
+         style="fill:#57ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3387"
+         d="m 154.9375,144.98437 46.61328,0 0,-45.347651 -46.61328,0 z"
+         style="fill:#ccff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         inkscape:connector-curvature="0"
+         id="path3389"
+         d="m 154.9375,99.636719 46.61328,0 0,-45.34375 -46.61328,0 z"
+         style="fill:#ffbd00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <g
+         id="g3391"
+         clip-rule="nonzero"
+         clip-path="url(#clip11)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3393"
+           d="m 154.9375,54.292969 46.61328,0 0,-45.34375 -46.61328,0 z"
+           style="fill:#ff4a00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3395"
+         clip-rule="nonzero"
+         clip-path="url(#clip12)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3397"
+           d="m 201.55078,235.67187 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#33ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3399"
+         clip-rule="nonzero"
+         clip-path="url(#clip13)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3401"
+           d="m 201.55078,190.32812 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#a6ff00;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3403"
+         clip-rule="nonzero"
+         clip-path="url(#clip14)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3405"
+           d="m 201.55078,144.98437 46.60938,0 0,-45.347651 -46.60938,0 z"
+           style="fill:#ffe300;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3407"
+         clip-rule="nonzero"
+         clip-path="url(#clip15)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3409"
+           d="m 201.55078,99.636719 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#ff7300;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+      <g
+         id="g3411"
+         clip-rule="nonzero"
+         clip-path="url(#clip16)">
+        <path
+           inkscape:connector-curvature="0"
+           id="path3413"
+           d="m 201.55078,54.292969 46.60938,0 0,-45.34375 -46.60938,0 z"
+           style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      </g>
+    </g>
+  </g>
+  <rect
+     
style="fill:none;fill-opacity:0.74901998;fill-rule:evenodd;stroke:#000000;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect5928"
+     width="170.38249"
+     height="159.80026"
+     x="29.993284"
+     y="26.574797"
+     rx="17.594519"
+     ry="14.164467" />
+  <text
+     xml:space="preserve"
+     
style="font-size:32px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation
 Serif"
+     x="69.718872"
+     y="165.17741"
+     id="text2350"><tspan
+       sodipodi:role="line"
+       id="tspan2352"
+       x="69.718872"
+       y="165.17741">XY</tspan></text>
+</svg>
diff --git a/plugins/plot_surface/chart_surface_2_3.png b/plugins/plot_surface/chart_surface_2_3.png
new file mode 100644
index 0000000..f35c5c1
Binary files /dev/null and b/plugins/plot_surface/chart_surface_2_3.png differ
diff --git a/plugins/plot_surface/chart_surface_2_3.svg b/plugins/plot_surface/chart_surface_2_3.svg
new file mode 100644
index 0000000..c03235c
--- /dev/null
+++ b/plugins/plot_surface/chart_surface_2_3.svg
@@ -0,0 +1,828 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   id="svg1"
+   sodipodi:version="0.32"
+   inkscape:version="0.48.3.1 r9886"
+   width="64.000000mm"
+   height="59.999998mm"
+   sodipodi:docname="chart_surface_2_3.svg"
+   inkscape:export-filename="/home/jean/devel/goffice/plugins/plot_surface/chart_surface_2_3.png"
+   inkscape:export-xdpi="25.4"
+   inkscape:export-ydpi="25.4"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   version="1.1">
+  <defs
+     id="defs3">
+    <linearGradient
+       id="linearGradient4044">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.0000000;"
+         offset="0.0000000"
+         id="stop4045" />
+      <stop
+         style="stop-color:#363636;stop-opacity:0.18750000;"
+         offset="1.0000000"
+         id="stop4046" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3418">
+      <stop
+         style="stop-color:#f7f7f7;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop3419" />
+      <stop
+         style="stop-color:#dedede;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop3420" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient2791">
+      <stop
+         style="stop-color:#fbfbfb;stop-opacity:1.0000000;"
+         offset="0.0000000"
+         id="stop2792" />
+      <stop
+         style="stop-color:#e9e9e9;stop-opacity:1.0000000;"
+         offset="1.0000000"
+         id="stop2793" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2791"
+       id="linearGradient2794"
+       x1="0.49693251"
+       y1="0.058441557"
+       x2="0.49079755"
+       y2="0.96103895" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3418"
+       id="linearGradient3417"
+       x1="114.60959"
+       y1="35.200919"
+       x2="113.68569"
+       y2="186.26885"
+       gradientTransform="scale(1.046497,0.955569)"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4044"
+       id="linearGradient4043"
+       x1="0.49689442"
+       y1="0.012987013"
+       x2="0.49689442"
+       y2="0.99350649" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0000000"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2"
+     inkscape:cx="127.24869"
+     inkscape:cy="130.45862"
+     inkscape:window-width="1024"
+     inkscape:window-height="693"
+     showborder="true"
+     showgrid="true"
+     inkscape:grid-points="true"
+     inkscape:grid-bbox="true"
+     gridtolerance="0.99999999px"
+     inkscape:guide-bbox="true"
+     inkscape:guide-points="true"
+     guidetolerance="1.0000000mm"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     showguides="true"
+     inkscape:current-layer="svg1"
+     inkscape:document-units="mm"
+     inkscape:window-maximized="0">
+    <sodipodi:guide
+       orientation="vertical"
+       position="23.994627"
+       id="guide5924" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="58.080453"
+       id="guide5925" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="92.166278"
+       id="guide5926" />
+    <sodipodi:guide
+       orientation="vertical"
+       position="126.25210"
+       id="guide5927" />
+    <inkscape:grid
+       id="GridFromPre046Settings"
+       type="xygrid"
+       originx="0.50000000mm"
+       originy="0.50000000mm"
+       spacingx="1.0000000mm"
+       spacingy="1.0000000mm"
+       color="#3f3fff"
+       empcolor="#3f3fff"
+       opacity="0.15"
+       empopacity="0.38"
+       empspacing="5" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata4">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect4047"
+     width="184.25197"
+     height="177.15660"
+     x="23.031496"
+     y="23.040251"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient4043);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;"
+     id="rect3421"
+     width="177.16536"
+     height="173.62204"
+     x="26.574802"
+     y="23.031490"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient2794);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;"
+     id="rect2169"
+     width="170.38249"
+     height="159.80026"
+     x="30.118111"
+     y="26.554472"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:url(#linearGradient3417);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+     id="rect3416"
+     width="163.39728"
+     height="149.19994"
+     x="31.955462"
+     y="31.923483"
+     rx="17.594519"
+     ry="14.164467" />
+  <rect
+     
style="fill:none;fill-opacity:1.0;fill-rule:evenodd;stroke:#000000;stroke-width:3.5300000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;stroke-dasharray:none"
+     id="rect5928"
+     width="170.38249"
+     height="159.80026"
+     x="29.993284"
+     y="26.574797"
+     rx="17.594519"
+     ry="14.164467" />
+  <g
+     id="g9083"
+     transform="matrix(1.3453951,0,0,1.1342235,-16.565559,-5.4700887)">
+    <path
+       id="path10686"
+       d="M 54.564338,95.862134 L 66.141444,76.647258 L 68.863577,83.267631 L 57.413471,101.6539 L 
54.564338,95.862134 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path10688"
+       d="M 54.564338,95.862134 L 66.141444,76.647258 L 68.863577,83.267631 L 57.413471,101.6539 L 
54.564338,95.862134 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path10842"
+       d="M 68.863577,83.267631 L 79.807077,68.818201 L 81.831037,80.442083 L 71.047687,93.820183 L 
68.863577,83.267631 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path10844"
+       d="M 68.863577,83.267631 L 79.807077,68.818201 L 81.831037,80.442083 L 71.047687,93.820183 L 
68.863577,83.267631 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path10846"
+       d="M 66.141444,76.647258 L 77.190827,61.529694 L 79.807077,68.818201 L 68.863577,83.267631 L 
66.141444,76.647258 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path10848"
+       d="M 66.141444,76.647258 L 77.190827,61.529694 L 79.807077,68.818201 L 68.863577,83.267631 L 
66.141444,76.647258 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path10850"
+       d="M 62.857639,74.139397 L 73.956277,58.775498 L 77.190827,61.529694 L 66.141444,76.647258 L 
62.857639,74.139397 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path10852"
+       d="M 62.857639,74.139397 L 73.956277,58.775498 L 77.190827,61.529694 L 66.141444,76.647258 L 
62.857639,74.139397 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path10998"
+       d="M 81.831037,80.442083 L 92.088517,71.132955 L 93.400707,87.849164 L 83.303097,96.095463 L 
81.831037,80.442083 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11000"
+       d="M 81.831037,80.442083 L 92.088517,71.132955 L 93.400707,87.849164 L 83.303097,96.095463 L 
81.831037,80.442083 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11002"
+       d="M 79.807077,68.818201 L 90.187177,58.721801 L 92.088517,71.132955 L 81.831037,80.442083 L 
79.807077,68.818201 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11004"
+       d="M 79.807077,68.818201 L 90.187177,58.721801 L 92.088517,71.132955 L 81.831037,80.442083 L 
79.807077,68.818201 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11006"
+       d="M 77.190827,61.529694 L 87.653477,50.94283 L 90.187177,58.721801 L 79.807077,68.818201 L 
77.190827,61.529694 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11008"
+       d="M 77.190827,61.529694 L 87.653477,50.94283 L 90.187177,58.721801 L 79.807077,68.818201 L 
77.190827,61.529694 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11010"
+       d="M 73.956277,58.775498 L 84.459497,48.008577 L 87.653477,50.94283 L 77.190827,61.529694 L 
73.956277,58.775498 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11012"
+       d="M 73.956277,58.775498 L 84.459497,48.008577 L 87.653477,50.94283 L 77.190827,61.529694 L 
73.956277,58.775498 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11014"
+       d="M 70.092357,60.64203 L 80.593497,50.011465 L 84.459497,48.008577 L 73.956277,58.775498 L 
70.092357,60.64203 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11016"
+       d="M 70.092357,60.64203 L 80.593497,50.011465 L 84.459497,48.008577 L 73.956277,58.775498 L 
70.092357,60.64203 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11018"
+       d="M 65.603346,67.100372 L 76.060057,56.920514 L 80.593497,50.011465 L 70.092357,60.64203 L 
65.603346,67.100372 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11020"
+       d="M 65.603346,67.100372 L 76.060057,56.920514 L 80.593497,50.011465 L 70.092357,60.64203 L 
65.603346,67.100372 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11022"
+       d="M 60.508895,78.006842 L 70.880167,68.58205 L 76.060057,56.920514 L 65.603346,67.100372 L 
60.508895,78.006842 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11024"
+       d="M 60.508895,78.006842 L 70.880167,68.58205 L 76.060057,56.920514 L 65.603346,67.100372 L 
60.508895,78.006842 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11026"
+       d="M 54.843348,93.106105 L 65.090678,84.722916 L 70.880167,68.58205 L 60.508895,78.006842 L 
54.843348,93.106105 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11028"
+       d="M 54.843348,93.106105 L 65.090678,84.722916 L 70.880167,68.58205 L 60.508895,78.006842 L 
54.843348,93.106105 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11030"
+       d="M 48.655236,112.03733 L 58.74342,104.95737 L 65.090678,84.722916 L 54.843348,93.106105 L 
48.655236,112.03733 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11032"
+       d="M 48.655236,112.03733 L 58.74342,104.95737 L 65.090678,84.722916 L 54.843348,93.106105 L 
48.655236,112.03733 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11154"
+       d="M 93.400707,87.849164 L 102.9871,83.549778 L 103.64115,104.94353 L 94.180977,108.43793 L 
93.400707,87.849164 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11156"
+       d="M 93.400707,87.849164 L 102.9871,83.549778 L 103.64115,104.94353 L 94.180977,108.43793 L 
93.400707,87.849164 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11158"
+       d="M 92.088517,71.132955 L 101.78037,66.181073 L 102.9871,83.549778 L 93.400707,87.849164 L 
92.088517,71.132955 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11160"
+       d="M 92.088517,71.132955 L 101.78037,66.181073 L 102.9871,83.549778 L 93.400707,87.849164 L 
92.088517,71.132955 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11162"
+       d="M 90.187177,58.721801 L 99.961307,53.287104 L 101.78037,66.181073 L 92.088517,71.132955 L 
90.187177,58.721801 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11164"
+       d="M 90.187177,58.721801 L 99.961307,53.287104 L 101.78037,66.181073 L 92.088517,71.132955 L 
90.187177,58.721801 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11166"
+       d="M 87.653477,50.94283 L 97.484927,45.207912 L 99.961307,53.287104 L 90.187177,58.721801 L 
87.653477,50.94283 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11168"
+       d="M 87.653477,50.94283 L 97.484927,45.207912 L 99.961307,53.287104 L 90.187177,58.721801 L 
87.653477,50.94283 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11170"
+       d="M 84.459497,48.008577 L 94.322287,42.164665 L 97.484927,45.207912 L 87.653477,50.94283 L 
84.459497,48.008577 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11172"
+       d="M 84.459497,48.008577 L 94.322287,42.164665 L 97.484927,45.207912 L 87.653477,50.94283 L 
84.459497,48.008577 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11174"
+       d="M 80.593497,50.011465 L 90.461077,44.253266 L 94.322287,42.164665 L 84.459497,48.008577 L 
80.593497,50.011465 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11176"
+       d="M 80.593497,50.011465 L 90.461077,44.253266 L 94.322287,42.164665 L 84.459497,48.008577 L 
80.593497,50.011465 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11178"
+       d="M 76.060057,56.920514 L 85.906147,51.441603 L 90.461077,44.253266 L 80.593497,50.011465 L 
76.060057,56.920514 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11180"
+       d="M 76.060057,56.920514 L 85.906147,51.441603 L 90.461077,44.253266 L 80.593497,50.011465 L 
76.060057,56.920514 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11182"
+       d="M 70.880167,68.58205 L 80.679307,63.569666 L 85.906147,51.441603 L 76.060057,56.920514 L 
70.880167,68.58205 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11184"
+       d="M 70.880167,68.58205 L 80.679307,63.569666 L 85.906147,51.441603 L 76.060057,56.920514 L 
70.880167,68.58205 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11186"
+       d="M 65.090678,84.722916 L 74.818907,80.353458 L 80.679307,63.569666 L 70.880167,68.58205 L 
65.090678,84.722916 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11188"
+       d="M 65.090678,84.722916 L 74.818907,80.353458 L 80.679307,63.569666 L 70.880167,68.58205 L 
65.090678,84.722916 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11190"
+       d="M 58.74342,104.95737 L 68.378945,101.39178 L 74.818907,80.353458 L 65.090678,84.722916 L 
58.74342,104.95737 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11192"
+       d="M 58.74342,104.95737 L 68.378945,101.39178 L 74.818907,80.353458 L 65.090678,84.722916 L 
58.74342,104.95737 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11314"
+       d="M 102.9871,83.549778 L 112.03926,83.36044 L 112.63708,105.03252 L 103.64115,104.94353 L 
102.9871,83.549778 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11316"
+       d="M 102.9871,83.549778 L 112.03926,83.36044 L 112.63708,105.03252 L 103.64115,104.94353 L 
102.9871,83.549778 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11318"
+       d="M 101.78037,66.181073 L 110.88105,65.766695 L 112.03926,83.36044 L 102.9871,83.549778 L 
101.78037,66.181073 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11320"
+       d="M 101.78037,66.181073 L 110.88105,65.766695 L 112.03926,83.36044 L 102.9871,83.549778 L 
101.78037,66.181073 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11322"
+       d="M 99.961307,53.287104 L 109.10213,52.706987 L 110.88105,65.766695 L 101.78037,66.181073 L 
99.961307,53.287104 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11324"
+       d="M 99.961307,53.287104 L 109.10213,52.706987 L 110.88105,65.766695 L 101.78037,66.181073 L 
99.961307,53.287104 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11326"
+       d="M 97.484927,45.207912 L 106.65688,44.525934 L 109.10213,52.706987 L 99.961307,53.287104 L 
97.484927,45.207912 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11328"
+       d="M 97.484927,45.207912 L 106.65688,44.525934 L 109.10213,52.706987 L 99.961307,53.287104 L 
97.484927,45.207912 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11330"
+       d="M 94.322287,42.164665 L 103.51588,41.447627 L 106.65688,44.525934 L 97.484927,45.207912 L 
94.322287,42.164665 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11332"
+       d="M 94.322287,42.164665 L 103.51588,41.447627 L 106.65688,44.525934 L 97.484927,45.207912 L 
94.322287,42.164665 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11334"
+       d="M 90.461077,44.253266 L 99.666687,43.569177 L 103.51588,41.447627 L 94.322287,42.164665 L 
90.461077,44.253266 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11336"
+       d="M 90.461077,44.253266 L 99.666687,43.569177 L 103.51588,41.447627 L 94.322287,42.164665 L 
90.461077,44.253266 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11338"
+       d="M 85.906147,51.441603 L 95.114217,50.858057 L 99.666687,43.569177 L 90.461077,44.253266 L 
85.906147,51.441603 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11340"
+       d="M 85.906147,51.441603 L 95.114217,50.858057 L 99.666687,43.569177 L 90.461077,44.253266 L 
85.906147,51.441603 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11342"
+       d="M 80.679307,63.569666 L 89.880587,63.152052 L 95.114217,50.858057 L 85.906147,51.441603 L 
80.679307,63.569666 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11344"
+       d="M 80.679307,63.569666 L 89.880587,63.152052 L 95.114217,50.858057 L 85.906147,51.441603 L 
80.679307,63.569666 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11346"
+       d="M 74.818907,80.353458 L 84.004777,80.16338 L 89.880587,63.152052 L 80.679307,63.569666 L 
74.818907,80.353458 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11348"
+       d="M 74.818907,80.353458 L 84.004777,80.16338 L 89.880587,63.152052 L 80.679307,63.569666 L 
74.818907,80.353458 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11350"
+       d="M 68.378945,101.39178 L 77.541417,101.48539 L 84.004777,80.16338 L 74.818907,80.353458 L 
68.378945,101.39178 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11352"
+       d="M 68.378945,101.39178 L 77.541417,101.48539 L 84.004777,80.16338 L 74.818907,80.353458 L 
68.378945,101.39178 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11470"
+       d="M 112.63708,105.03252 L 121.16063,108.75798 L 121.2922,133.65675 L 112.74843,130.22817 L 
112.63708,105.03252 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11472"
+       d="M 112.63708,105.03252 L 121.16063,108.75798 L 121.2922,133.65675 L 112.74843,130.22817 L 
112.63708,105.03252 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11474"
+       d="M 112.03926,83.36044 L 120.54762,87.342023 L 121.16063,108.75798 L 112.63708,105.03252 L 
112.03926,83.36044 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11476"
+       d="M 112.03926,83.36044 L 120.54762,87.342023 L 121.16063,108.75798 L 112.63708,105.03252 L 
112.03926,83.36044 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11478"
+       d="M 110.88105,65.766695 L 119.38018,69.957128 L 120.54762,87.342023 L 112.03926,83.36044 L 
110.88105,65.766695 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11480"
+       d="M 110.88105,65.766695 L 119.38018,69.957128 L 120.54762,87.342023 L 112.03926,83.36044 L 
110.88105,65.766695 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11482"
+       d="M 109.10213,52.706987 L 117.59855,57.053587 L 119.38018,69.957128 L 110.88105,65.766695 L 
109.10213,52.706987 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11484"
+       d="M 109.10213,52.706987 L 117.59855,57.053587 L 119.38018,69.957128 L 110.88105,65.766695 L 
109.10213,52.706987 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11486"
+       d="M 106.65688,44.525934 L 115.15767,48.971955 L 117.59855,57.053587 L 109.10213,52.706987 L 
106.65688,44.525934 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11488"
+       d="M 106.65688,44.525934 L 115.15767,48.971955 L 117.59855,57.053587 L 109.10213,52.706987 L 
106.65688,44.525934 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11490"
+       d="M 103.51588,41.447627 L 112.02845,45.933542 L 115.15767,48.971955 L 106.65688,44.525934 L 
103.51588,41.447627 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11492"
+       d="M 103.51588,41.447627 L 112.02845,45.933542 L 115.15767,48.971955 L 106.65688,44.525934 L 
103.51588,41.447627 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11494"
+       d="M 99.666687,43.569177 L 108.19863,48.034487 L 112.02845,45.933542 L 103.51588,41.447627 L 
99.666687,43.569177 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11496"
+       d="M 99.666687,43.569177 L 108.19863,48.034487 L 112.02845,45.933542 L 103.51588,41.447627 L 
99.666687,43.569177 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11498"
+       d="M 95.114217,50.858057 L 103.673,55.242492 L 108.19863,48.034487 L 99.666687,43.569177 L 
95.114217,50.858057 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11500"
+       d="M 95.114217,50.858057 L 103.673,55.242492 L 108.19863,48.034487 L 99.666687,43.569177 L 
95.114217,50.858057 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11502"
+       d="M 89.880587,63.152052 L 98.473507,67.397311 L 103.673,55.242492 L 95.114217,50.858057 L 
89.880587,63.152052 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11504"
+       d="M 89.880587,63.152052 L 98.473507,67.397311 L 103.673,55.242492 L 95.114217,50.858057 L 
89.880587,63.152052 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11506"
+       d="M 84.004777,80.16338 L 92.638617,84.214543 L 98.473507,67.397311 L 89.880587,63.152052 L 
84.004777,80.16338 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11508"
+       d="M 84.004777,80.16338 L 92.638617,84.214543 L 98.473507,67.397311 L 89.880587,63.152052 L 
84.004777,80.16338 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11510"
+       d="M 77.541417,101.48539 L 86.222457,105.29228 L 92.638617,84.214543 L 84.004777,80.16338 L 
77.541417,101.48539 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11512"
+       d="M 77.541417,101.48539 L 86.222457,105.29228 L 92.638617,84.214543 L 84.004777,80.16338 L 
77.541417,101.48539 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11634"
+       d="M 120.54762,87.342023 L 128.51662,95.45174 L 129.21557,116.08265 L 121.16063,108.75798 L 
120.54762,87.342023 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11636"
+       d="M 120.54762,87.342023 L 128.51662,95.45174 L 129.21557,116.08265 L 121.16063,108.75798 L 
120.54762,87.342023 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11638"
+       d="M 119.38018,69.957128 L 127.28258,78.705013 L 128.51662,95.45174 L 120.54762,87.342023 L 
119.38018,69.957128 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11640"
+       d="M 119.38018,69.957128 L 127.28258,78.705013 L 128.51662,95.45174 L 120.54762,87.342023 L 
119.38018,69.957128 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11642"
+       d="M 117.59855,57.053587 L 125.45574,66.276125 L 127.28258,78.705013 L 119.38018,69.957128 L 
117.59855,57.053587 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11644"
+       d="M 117.59855,57.053587 L 125.45574,66.276125 L 127.28258,78.705013 L 119.38018,69.957128 L 
117.59855,57.053587 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11646"
+       d="M 115.15767,48.971955 L 122.9928,58.492973 L 125.45574,66.276125 L 117.59855,57.053587 L 
115.15767,48.971955 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11648"
+       d="M 115.15767,48.971955 L 122.9928,58.492973 L 125.45574,66.276125 L 117.59855,57.053587 L 
115.15767,48.971955 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11650"
+       d="M 112.02845,45.933542 L 119.86564,55.568766 L 122.9928,58.492973 L 115.15767,48.971955 L 
112.02845,45.933542 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11652"
+       d="M 112.02845,45.933542 L 119.86564,55.568766 L 122.9928,58.492973 L 115.15767,48.971955 L 
112.02845,45.933542 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11654"
+       d="M 108.19863,48.034487 L 116.0624,57.596019 L 119.86564,55.568766 L 112.02845,45.933542 L 
108.19863,48.034487 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11656"
+       d="M 108.19863,48.034487 L 116.0624,57.596019 L 119.86564,55.568766 L 112.02845,45.933542 L 
108.19863,48.034487 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11658"
+       d="M 103.673,55.242492 L 111.58782,64.543651 L 116.0624,57.596019 L 108.19863,48.034487 L 
103.673,55.242492 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11660"
+       d="M 103.673,55.242492 L 111.58782,64.543651 L 116.0624,57.596019 L 108.19863,48.034487 L 
103.673,55.242492 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11662"
+       d="M 98.473507,67.397311 L 106.463,76.257333 L 111.58782,64.543651 L 103.673,55.242492 L 
98.473507,67.397311 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11664"
+       d="M 98.473507,67.397311 L 106.463,76.257333 L 111.58782,64.543651 L 103.673,55.242492 L 
98.473507,67.397311 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11666"
+       d="M 92.638617,84.214543 L 100.72502,92.463183 L 106.463,76.257333 L 98.473507,67.397311 L 
92.638617,84.214543 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11668"
+       d="M 92.638617,84.214543 L 100.72502,92.463183 L 106.463,76.257333 L 98.473507,67.397311 L 
92.638617,84.214543 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11670"
+       d="M 86.222457,105.29228 L 94.426037,112.77417 L 100.72502,92.463183 L 92.638617,84.214543 L 
86.222457,105.29228 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11672"
+       d="M 86.222457,105.29228 L 94.426037,112.77417 L 100.72502,92.463183 L 92.638617,84.214543 L 
86.222457,105.29228 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11798"
+       d="M 127.28258,78.705013 L 134.60837,91.849297 L 135.96452,107.54393 L 128.51662,95.45174 L 
127.28258,78.705013 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11800"
+       d="M 127.28258,78.705013 L 134.60837,91.849297 L 135.96452,107.54393 L 128.51662,95.45174 L 
127.28258,78.705013 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11802"
+       d="M 125.45574,66.276125 L 132.69532,80.202077 L 134.60837,91.849297 L 127.28258,78.705013 L 
125.45574,66.276125 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11804"
+       d="M 125.45574,66.276125 L 132.69532,80.202077 L 134.60837,91.849297 L 127.28258,78.705013 L 
125.45574,66.276125 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11806"
+       d="M 122.9928,58.492973 L 130.18463,72.909409 L 132.69532,80.202077 L 125.45574,66.276125 L 
122.9928,58.492973 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11808"
+       d="M 122.9928,58.492973 L 130.18463,72.909409 L 132.69532,80.202077 L 125.45574,66.276125 L 
122.9928,58.492973 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11810"
+       d="M 119.86564,55.568766 L 127.05009,70.170983 L 130.18463,72.909409 L 122.9928,58.492973 L 
119.86564,55.568766 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11812"
+       d="M 119.86564,55.568766 L 127.05009,70.170983 L 130.18463,72.909409 L 122.9928,58.492973 L 
119.86564,55.568766 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11814"
+       d="M 116.0624,57.596019 L 123.28055,72.07338 L 127.05009,70.170983 L 119.86564,55.568766 L 
116.0624,57.596019 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11816"
+       d="M 116.0624,57.596019 L 123.28055,72.07338 L 127.05009,70.170983 L 119.86564,55.568766 L 
116.0624,57.596019 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11818"
+       d="M 111.58782,64.543651 L 118.88044,78.587537 L 123.28055,72.07338 L 116.0624,57.596019 L 
111.58782,64.543651 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11820"
+       d="M 111.58782,64.543651 L 118.88044,78.587537 L 123.28055,72.07338 L 116.0624,57.596019 L 
111.58782,64.543651 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11822"
+       d="M 106.463,76.257333 L 113.86947,89.568972 L 118.88044,78.587537 L 111.58782,64.543651 L 
106.463,76.257333 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11824"
+       d="M 106.463,76.257333 L 113.86947,89.568972 L 118.88044,78.587537 L 111.58782,64.543651 L 
106.463,76.257333 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11826"
+       d="M 100.72502,92.463183 L 108.28247,104.76111 L 113.86947,89.568972 L 106.463,76.257333 L 
100.72502,92.463183 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11828"
+       d="M 100.72502,92.463183 L 108.28247,104.76111 L 113.86947,89.568972 L 106.463,76.257333 L 
100.72502,92.463183 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11830"
+       d="M 94.426037,112.77417 L 102.16834,123.80157 L 108.28247,104.76111 L 100.72502,92.463183 L 
94.426037,112.77417 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11832"
+       d="M 94.426037,112.77417 L 102.16834,123.80157 L 108.28247,104.76111 L 100.72502,92.463183 L 
94.426037,112.77417 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11962"
+       d="M 132.69532,80.202077 L 139.35464,98.541591 L 141.39253,109.11925 L 134.60837,91.849297 L 
132.69532,80.202077 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11964"
+       d="M 132.69532,80.202077 L 139.35464,98.541591 L 141.39253,109.11925 L 134.60837,91.849297 L 
132.69532,80.202077 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11966"
+       d="M 130.18463,72.909409 L 136.77221,91.919402 L 139.35464,98.541591 L 132.69532,80.202077 L 
130.18463,72.909409 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11968"
+       d="M 130.18463,72.909409 L 136.77221,91.919402 L 139.35464,98.541591 L 132.69532,80.202077 L 
130.18463,72.909409 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11970"
+       d="M 127.05009,70.170983 L 133.62142,89.433743 L 136.77221,91.919402 L 130.18463,72.909409 L 
127.05009,70.170983 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11972"
+       d="M 127.05009,70.170983 L 133.62142,89.433743 L 136.77221,91.919402 L 130.18463,72.909409 L 
127.05009,70.170983 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11974"
+       d="M 123.28055,72.07338 L 129.89219,91.163335 L 133.62142,89.433743 L 127.05009,70.170983 L 
123.28055,72.07338 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11976"
+       d="M 123.28055,72.07338 L 129.89219,91.163335 L 133.62142,89.433743 L 127.05009,70.170983 L 
123.28055,72.07338 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11978"
+       d="M 118.88044,78.587537 L 125.58844,97.081752 L 129.89219,91.163335 L 123.28055,72.07338 L 
118.88044,78.587537 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11980"
+       d="M 118.88044,78.587537 L 125.58844,97.081752 L 129.89219,91.163335 L 123.28055,72.07338 L 
118.88044,78.587537 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11982"
+       d="M 113.86947,89.568972 L 120.72822,107.05798 L 125.58844,97.081752 L 118.88044,78.587537 L 
113.86947,89.568972 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11984"
+       d="M 113.86947,89.568972 L 120.72822,107.05798 L 125.58844,97.081752 L 118.88044,78.587537 L 
113.86947,89.568972 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11986"
+       d="M 108.28247,104.76111 L 115.34306,120.85918 L 120.72822,107.05798 L 113.86947,89.568972 L 
108.28247,104.76111 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11988"
+       d="M 108.28247,104.76111 L 115.34306,120.85918 L 120.72822,107.05798 L 113.86947,89.568972 L 
108.28247,104.76111 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path11990"
+       d="M 102.16834,123.80157 L 109.47735,138.15655 L 115.34306,120.85918 L 108.28247,104.76111 L 
102.16834,123.80157 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path11992"
+       d="M 102.16834,123.80157 L 109.47735,138.15655 L 115.34306,120.85918 L 108.28247,104.76111 L 
102.16834,123.80157 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path12130"
+       d="M 133.62142,89.433743 L 139.63477,112.93447 L 142.80989,115.10639 L 136.77221,91.919402 L 
133.62142,89.433743 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path12132"
+       d="M 133.62142,89.433743 L 139.63477,112.93447 L 142.80989,115.10639 L 136.77221,91.919402 L 
133.62142,89.433743 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path12134"
+       d="M 129.89219,91.163335 L 135.95187,114.44768 L 139.63477,112.93447 L 133.62142,89.433743 L 
129.89219,91.163335 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path12136"
+       d="M 129.89219,91.163335 L 135.95187,114.44768 L 139.63477,112.93447 L 133.62142,89.433743 L 
129.89219,91.163335 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path12138"
+       d="M 125.58844,97.081752 L 131.76457,119.62298 L 135.95187,114.44768 L 129.89219,91.163335 L 
125.58844,97.081752 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path12140"
+       d="M 125.58844,97.081752 L 131.76457,119.62298 L 135.95187,114.44768 L 129.89219,91.163335 L 
125.58844,97.081752 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path12142"
+       d="M 120.72822,107.05798 L 127.08863,128.34607 L 131.76457,119.62298 L 125.58844,97.081752 L 
120.72822,107.05798 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path12144"
+       d="M 120.72822,107.05798 L 127.08863,128.34607 L 131.76457,119.62298 L 125.58844,97.081752 L 
120.72822,107.05798 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path12146"
+       d="M 115.34306,120.85918 L 121.95163,140.41365 L 127.08863,128.34607 L 120.72822,107.05798 L 
115.34306,120.85918 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path12148"
+       d="M 115.34306,120.85918 L 121.95163,140.41365 L 127.08863,128.34607 L 120.72822,107.05798 L 
115.34306,120.85918 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+    <path
+       id="path12150"
+       d="M 109.47735,138.15655 L 116.39237,155.53854 L 121.95163,140.41365 L 115.34306,120.85918 L 
109.47735,138.15655 z "
+       style="fill:#82a67d;fill-rule:nonzero;stroke:none" />
+    <path
+       id="path12152"
+       d="M 109.47735,138.15655 L 116.39237,155.53854 L 121.95163,140.41365 L 115.34306,120.85918 L 
109.47735,138.15655 z "
+       
style="fill:none;stroke:#000000;stroke-width:1.38810027;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10"
 />
+  </g>
+  <text
+     xml:space="preserve"
+     
style="font-size:32px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Liberation
 Serif"
+     x="69.363609"
+     y="165.17715"
+     id="text2350"><tspan
+       sodipodi:role="line"
+       id="tspan2352"
+       x="69.363609"
+       y="165.17715">XY</tspan></text>
+</svg>
diff --git a/plugins/plot_surface/gog-contour.c b/plugins/plot_surface/gog-contour.c
index 5d03cbf..3566eb9 100644
--- a/plugins/plot_surface/gog-contour.c
+++ b/plugins/plot_surface/gog-contour.c
@@ -1,5 +1,5 @@
 /*
- * gog-xyz.c
+ * gog-contour.c
  *
  * Copyright (C) 2004-2007 Jean Brefort (jean brefort normalesup org)
  *
@@ -46,7 +46,7 @@ static GType gog_contour_view_get_type (void);
  */
 
 static double *
-gog_contour_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_changed)
+gog_contour_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
 {
        unsigned i, j;
        GogAxisMap *map;
@@ -59,9 +59,10 @@ gog_contour_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_cha
        unsigned n = plot->rows * plot->columns;
        double *data, minimum, maximum, slope, offset = 0.;
        unsigned max;
+       gboolean has_scale = gog_axis_get_color_scale (axis) != NULL;
 
        if (!gog_axis_get_bounds (axis, &minimum, &maximum)) {
-               series->num_elements = 2;
+               series->num_elements = has_scale? 1: 2;
                *cardinality_changed = TRUE;
                return NULL;
        }
@@ -109,10 +110,11 @@ gog_contour_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_cha
                        else
                                data[i * plot->columns + j] = val;
                }
-       if (series->num_elements != max) {
-               series->num_elements = max;
+       if ((has_scale && series->num_elements != 1) || series->num_elements != max) {
+               series->num_elements = has_scale? 1: max;
                *cardinality_changed = TRUE;
        }
+       GOG_CONTOUR_PLOT (plot)->max_colors = max;
        gog_axis_map_free (map);
        g_free (x);
        if (max < 2) { /* this might happen with bad 3d axis configuration */
@@ -151,6 +153,10 @@ gog_contour_plot_foreach_elem  (GogPlot *plot, gboolean only_visible,
                func (0, style,
                          gog_object_get_name (plot->series->data), NULL, data);
 
+       if (gog_axis_get_color_scale (axis)) {
+               g_object_unref (style);
+               return;
+       }
        gog_axis_get_bounds (axis, &minimum, &maximum);
 
        nticks = gog_axis_get_ticks (axis, &zticks);
@@ -278,7 +284,7 @@ gog_contour_view_render (GogView *view, GogViewAllocation const *bbox)
        if (plot->base.series == NULL)
                return;
        series = GOG_SERIES (plot->base.series->data);
-       max = series->num_elements;
+       max = GOG_CONTOUR_PLOT (plot)->max_colors;
        if (plot->transposed) {
                imax = plot->columns;
                jmax = plot->rows;
@@ -292,8 +298,6 @@ gog_contour_view_render (GogView *view, GogViewAllocation const *bbox)
        if (plot->plotted_data)
                data = plot->plotted_data;
        else
-               data = gog_xyz_plot_build_matrix (plot, &cw);
-       if (data == NULL)
                return;
 
        x_map = gog_axis_map_new (plot->base.axis[0],
@@ -1039,6 +1043,8 @@ gog_contour_view_render (GogView *view, GogViewAllocation const *bbox)
        g_free (color);
        gog_axis_map_free (x_map);
        gog_axis_map_free (y_map);
+       if (!plot->plotted_data)
+               g_free (data);
 }
 
 static void
diff --git a/plugins/plot_surface/gog-contour.h b/plugins/plot_surface/gog-contour.h
index 8869ed9..969edef 100644
--- a/plugins/plot_surface/gog-contour.h
+++ b/plugins/plot_surface/gog-contour.h
@@ -33,7 +33,10 @@ G_BEGIN_DECLS
  *-----------------------------------------------------------------------------
  */
 
-typedef GogXYZPlot GogContourPlot;
+typedef struct {
+       GogXYZPlot base;
+       unsigned max_colors;
+} GogContourPlot;
 typedef GogXYZPlotClass GogContourPlotClass;
 
 #define GOG_TYPE_CONTOUR_PLOT  (gog_contour_plot_get_type ())
diff --git a/plugins/plot_surface/gog-matrix.c b/plugins/plot_surface/gog-matrix.c
new file mode 100644
index 0000000..ca24c50
--- /dev/null
+++ b/plugins/plot_surface/gog-matrix.c
@@ -0,0 +1,229 @@
+/*
+ * gog-matrix.c
+ *
+ * Copyright (C) 2013 Jean Brefort (jean brefort normalesup org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ */
+
+#include <goffice/goffice-config.h>
+#include <goffice/goffice.h>
+#include "gog-matrix.h"
+
+#include <gsf/gsf-impl-utils.h>
+#include <glib/gi18n-lib.h>
+
+static GType gog_matrix_view_get_type (void);
+
+/*-----------------------------------------------------------------------------
+ *
+ *  GogMatrixPlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static double *
+gog_matrix_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
+{
+       unsigned i, j;
+       double val;
+       GOData *mat = GOG_SERIES (plot->base.series->data)->values[2].data;
+       unsigned n = plot->rows * plot->columns;
+       double *data;
+
+       if (cardinality_changed)
+               *cardinality_changed = FALSE;
+       if (n == 0)
+               return NULL;
+       data = g_new (double, n);
+
+       for (i = 0; i < plot->rows; i++)
+               for (j = 0; j < plot->columns; j++) {
+                       val = go_data_get_matrix_value (mat, i, j);
+                       if (plot->transposed)
+                               data[j * plot->rows + i] = val;
+                       else
+                               data[i * plot->columns + j] = val;
+               }
+
+       return data;
+}
+
+static char const *
+gog_matrix_plot_type_name (G_GNUC_UNUSED GogObject const *item)
+{
+       /* xgettext : the base for how to name matrix objects
+       */
+       return N_("PlotMatrix");
+}
+
+static void
+gog_matrix_plot_class_init (GogMatrixPlotClass *klass)
+{
+       GogXYZPlotClass *gog_xyz_plot_klass = (GogXYZPlotClass *) klass;
+       GogPlotClass *gog_plot_klass = (GogPlotClass*) klass;
+       GogObjectClass *gog_object_klass = (GogObjectClass *) klass;
+
+       /* Fill in GogObject superclass values */
+       gog_object_klass->type_name     = gog_matrix_plot_type_name;
+       gog_object_klass->view_type     = gog_matrix_view_get_type ();
+
+       gog_plot_klass->axis_set = GOG_AXIS_SET_XY_COLOR;
+       gog_plot_klass->desc.series.style_fields = 0;
+
+       gog_xyz_plot_klass->third_axis = GOG_AXIS_COLOR;
+       gog_xyz_plot_klass->build_matrix = gog_matrix_plot_build_matrix;
+}
+
+static void
+gog_matrix_plot_init (GogMatrixPlot *matrix)
+{
+       GogPlot *plot = GOG_PLOT (matrix);
+
+       plot->rendering_order = GOG_PLOT_RENDERING_BEFORE_GRID;
+}
+
+GSF_DYNAMIC_CLASS (GogMatrixPlot, gog_matrix_plot,
+       gog_matrix_plot_class_init, gog_matrix_plot_init,
+       GOG_TYPE_XYZ_PLOT)
+
+/*-----------------------------------------------------------------------------
+ *
+ *  GogMatrixView
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+typedef GogPlotView            GogMatrixView;
+typedef GogPlotViewClass       GogMatrixViewClass;
+
+static void
+gog_matrix_view_render (GogView *view, GogViewAllocation const *bbox)
+{
+       GogXYZPlot const *plot = GOG_XYZ_PLOT (view->model);
+       GogSeries const *series;
+       GOData *x_vec = NULL, *y_vec = NULL;
+       GogAxisMap *x_map, *y_map, *z_map;
+       GogAxisColorMap const *color_map = gog_axis_get_color_map (gog_plot_get_axis (GOG_PLOT (view->model), 
GOG_AXIS_COLOR));
+       unsigned i, imax, j, jmax;
+       double max, *data, z;
+       GogRenderer *rend = view->renderer;
+       GOStyle *style;
+       gboolean xdiscrete, ydiscrete, hide_outliers = TRUE;
+       GogViewAllocation rect;
+
+       if (plot->base.series == NULL)
+               return;
+       series = GOG_SERIES (plot->base.series->data);
+       if (plot->transposed) {
+               imax = plot->columns;
+               jmax = plot->rows;
+       } else {
+               imax = plot->rows;
+               jmax = plot->columns;
+       }
+       if (imax == 0 || jmax == 0)
+               return;
+
+       if (plot->plotted_data)
+               data = plot->plotted_data;
+       else
+               return;
+
+       x_map = gog_axis_map_new (plot->base.axis[0],
+                                 view->residual.x , view->residual.w);
+       y_map = gog_axis_map_new (plot->base.axis[1],
+                                 view->residual.y + view->residual.h,
+                                 -view->residual.h);
+
+       if (!(gog_axis_map_is_valid (x_map) &&
+             gog_axis_map_is_valid (y_map))) {
+               gog_axis_map_free (x_map);
+               gog_axis_map_free (y_map);
+               return;
+       }
+
+       max = gog_axis_color_map_get_max (color_map);
+       z_map = gog_axis_map_new (plot->base.axis[GOG_AXIS_COLOR], 0, max);
+
+       xdiscrete = gog_axis_is_discrete (plot->base.axis[0]) ||
+                       series->values[(plot->transposed)? 1: 0].data == NULL;
+       if (!xdiscrete)
+               x_vec = gog_xyz_plot_get_x_vals (GOG_XYZ_PLOT (plot));
+       ydiscrete = gog_axis_is_discrete (plot->base.axis[1]) ||
+                       series->values[(plot->transposed)? 0: 1].data == NULL;
+       if (!ydiscrete)
+               y_vec = gog_xyz_plot_get_y_vals (GOG_XYZ_PLOT (plot));
+       /* clip to avoid problems with logarithmic axes */
+       gog_renderer_push_clip_rectangle (rend, view->residual.x, view->residual.y,
+                                         view->residual.w, view->residual.h);
+
+       style = go_style_new ();
+       style->interesting_fields = GO_STYLE_FILL;
+       style->disable_theming = GO_STYLE_ALL;
+       style->fill.type = GO_STYLE_FILL_PATTERN;
+       style->fill.pattern.pattern = GO_PATTERN_SOLID;
+       gog_renderer_push_style (rend, style);
+
+       for (j = 0; j < jmax; j++) {
+               if (xdiscrete) {
+                       rect.x = gog_axis_map_to_view (x_map, j);
+                       rect.w = gog_axis_map_to_view (x_map, j + 1) - rect.x;
+               } else {
+                       rect.x = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, j));
+                       rect.w = gog_axis_map_to_view (x_map, go_data_get_vector_value (x_vec, j + 1)) - 
rect.x;
+               }
+
+               for (i = 0; i < imax; i++) {
+                       if (ydiscrete) {
+                               rect.y = gog_axis_map_to_view (y_map, i);
+                               rect.h = gog_axis_map_to_view (y_map, i + 1) - rect.y;
+                       } else {
+                               rect.y = gog_axis_map_to_view (y_map, go_data_get_vector_value (y_vec, i));
+                               rect.h = gog_axis_map_to_view (y_map, go_data_get_vector_value (y_vec, i + 
1)) - rect.y;
+                       }
+                       z = data[(i) * jmax + j];
+                       if (gog_axis_map_finite (z_map, z)) {
+                               double zc = gog_axis_map_to_view (z_map, z);
+                               if (hide_outliers && (zc < 0 || zc > max))
+                                       style->fill.pattern.back = 0;
+                               else
+                                       style->fill.pattern.back = gog_axis_color_map_get_color (color_map, 
CLAMP (zc, 0, max));
+                       } else
+                               style->fill.pattern.back = 0;
+                       gog_renderer_draw_rectangle (rend, &rect);
+               }
+       }
+
+       gog_renderer_pop_style (rend);
+       gog_renderer_pop_clip (rend);
+       g_object_unref (style);
+       gog_axis_map_free (x_map);
+       gog_axis_map_free (y_map);
+       gog_axis_map_free (z_map);
+       if (!plot->plotted_data)
+               g_free (data);
+}
+
+static void
+gog_matrix_view_class_init (GogViewClass *view_klass)
+{
+       view_klass->render = gog_matrix_view_render;
+}
+
+GSF_DYNAMIC_CLASS (GogMatrixView, gog_matrix_view,
+       gog_matrix_view_class_init, NULL,
+       GOG_TYPE_PLOT_VIEW)
diff --git a/plugins/plot_surface/gog-matrix.h b/plugins/plot_surface/gog-matrix.h
new file mode 100644
index 0000000..7e03eb5
--- /dev/null
+++ b/plugins/plot_surface/gog-matrix.h
@@ -0,0 +1,50 @@
+/*
+ * gog-matrix.h
+ *
+ * Copyright (C) 2013 Jean Brefort (jean brefort normalesup org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
+ * USA
+ */
+
+#ifndef GOG_MATRIX_H
+#define GOG_MATRIX_H
+
+#include "gog-xyz.h"
+
+G_BEGIN_DECLS
+
+/*-----------------------------------------------------------------------------
+ *
+ * GogMatrixPlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+typedef GogXYZPlot GogMatrixPlot;
+typedef GogXYZPlotClass GogMatrixPlotClass;
+
+#define GOG_TYPE_MATRIX_PLOT   (gog_matrix_plot_get_type ())
+#define GOG_MATRIX_PLOT(o)     (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_MATRIX_PLOT, GogMatrixPlot))
+#define GOG_IS_MATRIX_PLOT(o)  (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_MATRIX_PLOT))
+
+GType gog_matrix_plot_get_type (void);
+void  gog_matrix_plot_register_type   (GTypeModule *module);
+
+void  gog_matrix_view_register_type   (GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* GOG_MATRIX_H */
diff --git a/plugins/plot_surface/gog-surface.c b/plugins/plot_surface/gog-surface.c
index f0faa14..7b6629c 100644
--- a/plugins/plot_surface/gog-surface.c
+++ b/plugins/plot_surface/gog-surface.c
@@ -37,7 +37,7 @@
 static GType gog_surface_view_get_type (void);
 
 static double *
-gog_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_changed)
+gog_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
 {
        unsigned i, j;
        double val;
@@ -126,21 +126,19 @@ gog_surface_view_render (GogView *view, GogViewAllocation const *bbox)
        GogChartMap3D *chart_map;
        GogChart *chart = GOG_CHART (view->model->parent);
        GogViewAllocation const *area;
-       int i, imax, j, jmax, max, nbvalid;
+       int i, imax, j, jmax, nbvalid;
        double x, y, z, x0, y0, x1, y1;
        GogRenderer *rend = view->renderer;
        GOStyle *style;
        double *data;
        GOData *x_vec = NULL, *y_vec = NULL;
        gboolean xdiscrete, ydiscrete;
-       gboolean cw;
        GSList *tiles = NULL, *cur;
        GogSurfaceTile *tile;
 
        if (plot->base.series == NULL)
                return;
        series = GOG_SERIES (plot->base.series->data);
-       max = series->num_elements;
        if (plot->transposed) {
                imax = plot->rows;
                jmax = plot->columns;
@@ -155,8 +153,6 @@ gog_surface_view_render (GogView *view, GogViewAllocation const *bbox)
        if (plot->plotted_data)
                data = plot->plotted_data;
        else
-               data = gog_xyz_plot_build_matrix (plot, &cw);
-       if (data == NULL)
                return;
 
        chart_map = gog_chart_map_3d_new (chart, area,
@@ -261,6 +257,8 @@ gog_surface_view_render (GogView *view, GogViewAllocation const *bbox)
 
        gog_renderer_pop_style (rend);
        gog_chart_map_3d_free (chart_map);
+       if (!plot->plotted_data)
+               g_free (data);
 }
 
 static void
diff --git a/plugins/plot_surface/gog-xyz-surface-prefs.c b/plugins/plot_surface/gog-xyz-surface-prefs.c
index 17670ef..e73c312 100644
--- a/plugins/plot_surface/gog-xyz-surface-prefs.c
+++ b/plugins/plot_surface/gog-xyz-surface-prefs.c
@@ -24,6 +24,7 @@
 #include <goffice/gtk/goffice-gtk.h>
 #include <goffice/app/go-plugin.h>
 
+#include <glib/gi18n-lib.h>
 #include <string.h>
 
 GtkWidget *gog_xyz_surface_plot_pref   (GogXYZPlot *plot, GogDataAllocator *dalloc, GOCmdContext *cc);
@@ -86,12 +87,21 @@ cb_missing_as_changed (GtkComboBoxText *box, XYZSurfPrefsState *state)
 
 }
 
+static void
+cb_as_density_toggled (GtkToggleButton *btn, XYZSurfPrefsState *state)
+{
+       g_object_set (state->plot,
+                     "as_density", gtk_toggle_button_get_active (btn),
+                     NULL);
+
+}
 GtkWidget *
 gog_xyz_surface_plot_pref (GogXYZPlot *plot, GogDataAllocator *dalloc, GOCmdContext *cc)
 {
        GogDataset *set = GOG_DATASET (plot);
        XYZSurfPrefsState *state;
        GtkWidget  *w, *grid;
+       int prop;
        GtkBuilder *gui =
                go_gtk_builder_load ("res:go:plot_surface/gog-xyz-surface-prefs.ui",
                                    GETTEXT_PACKAGE, cc);
@@ -146,11 +156,20 @@ gog_xyz_surface_plot_pref (GogXYZPlot *plot, GogDataAllocator *dalloc, GOCmdCont
        g_signal_connect (G_OBJECT (w), "toggled", G_CALLBACK (cb_rows_toggled), state);
 
        w = go_gtk_builder_get_widget (gui, "missing-as-btn");
-       gtk_combo_box_set_active (GTK_COMBO_BOX (w),
-                                 GOG_IS_CONTOUR_PLOT (plot)?
-                                     GOG_XYZ_CONTOUR_PLOT (plot)->missing_as:
-                                         GOG_XYZ_SURFACE_PLOT (plot)->missing_as);
-       g_signal_connect (G_OBJECT (w), "changed", G_CALLBACK (cb_missing_as_changed), state);
+       if (GOG_PLOT (plot)->desc.series.num_dim == 2) {
+               gtk_widget_hide (w);
+               gtk_widget_hide (go_gtk_builder_get_widget (gui, "missing-lbl"));
+               w = gtk_check_button_new_with_label (_("Display population density"));
+               gtk_container_add (GTK_CONTAINER (grid), w);
+               gtk_widget_show (w);
+               g_object_get (plot, "as-density", &prop, NULL);
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), prop);
+               g_signal_connect (G_OBJECT (w), "toggled", G_CALLBACK (cb_as_density_toggled), state);
+       } else {
+               g_object_get (plot, "missing-as", &prop, NULL);
+               gtk_combo_box_set_active (GTK_COMBO_BOX (w), prop);
+               g_signal_connect (G_OBJECT (w), "changed", G_CALLBACK (cb_missing_as_changed), state);
+       }
 
        w = GTK_WIDGET (g_object_ref (grid));
        g_object_set_data_full (G_OBJECT (w), "state", state, g_free);
diff --git a/plugins/plot_surface/gog-xyz-surface-prefs.ui b/plugins/plot_surface/gog-xyz-surface-prefs.ui
index 15ac74f..461ae24 100644
--- a/plugins/plot_surface/gog-xyz-surface-prefs.ui
+++ b/plugins/plot_surface/gog-xyz-surface-prefs.ui
@@ -19,6 +19,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">12</property>
+    <property name="orientation">vertical</property>
     <property name="row_spacing">6</property>
     <property name="column_spacing">12</property>
     <child>
@@ -217,18 +218,6 @@
       </packing>
     </child>
     <child>
-      <placeholder/>
-    </child>
-    <child>
-      <placeholder/>
-    </child>
-    <child>
-      <placeholder/>
-    </child>
-    <child>
-      <placeholder/>
-    </child>
-    <child>
       <object class="GtkComboBoxText" id="missing-as-btn">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
@@ -246,5 +235,17 @@
         <property name="height">1</property>
       </packing>
     </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index 04a3834..5f42943 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -1,7 +1,7 @@
 /*
  * gog-xyz-surface.c
  *
- * Copyright (C) 2004-2005 Jean Brefort (jean brefort normalesup org)
+ * Copyright (C) 2004-2013 Jean Brefort (jean brefort normalesup org)
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -22,13 +22,7 @@
 #include <goffice/goffice-config.h>
 #include "gog-xyz-surface.h"
 
-#include <goffice/data/go-data.h>
-#include <goffice/graph/gog-chart-map-3d.h>
-#include <goffice/graph/gog-renderer.h>
-#include <goffice/math/go-math.h>
-#include <goffice/utils/go-format.h>
-#include <goffice/utils/go-path.h>
-#include <goffice/utils/go-persist.h>
+#include <goffice/goffice.h>
 
 #include <glib/gi18n-lib.h>
 #include <gsf/gsf-impl-utils.h>
@@ -76,12 +70,9 @@ enum {
        XYZ_SURFACE_PROP_COLUMNS,
        XYZ_SURFACE_PROP_AUTO_ROWS,
        XYZ_SURFACE_PROP_AUTO_COLUMNS,
-       XYZ_SURFACE_PROP_MISSING_AS
+       XYZ_SURFACE_PROP_EXTRA1
 };
 
-static GogObjectClass *plot_xyz_contour_parent_klass;
-static GogObjectClass *plot_xyz_surface_parent_klass;
-
 #define EPSILON 1e-13
 
 typedef struct {
@@ -103,7 +94,7 @@ data_compare (unsigned const *a, unsigned const *b, xyz_data *data)
 }
 
 static double *
-gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_changed)
+gog_xyz_matrix_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
 {
        unsigned i, j, k, l, index;
        GogSeries *series = GOG_SERIES (plot->base.series->data);
@@ -111,36 +102,192 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
        double *x_limits, *y_limits;
        double *data;
        unsigned *grid, n, kmax, imax, jmax;
-       double xmin, ymin, xinc, yinc;
        xyz_data raw_data;
        unsigned *sort;
-       if (GOG_IS_CONTOUR_PLOT (plot)) {
-               GogXYZContourPlot *xyz = GOG_XYZ_CONTOUR_PLOT (plot);
+       gboolean is_3d = GOG_PLOT (plot)->desc.series.num_dim == 3;
+       
+       if (GOG_IS_XYZ_MATRIX_PLOT (plot)) {
+               GogXYZMatrixPlot *xyz = GOG_XYZ_MATRIX_PLOT (plot);
                if (xyz->grid[0].data) {
                        if (xyz->base.x_vals)
                                g_object_unref (xyz->base.x_vals);
                        xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
-                       xyz->base.columns = go_data_get_vector_size (plot->x_vals);
+                       xyz->base.columns = go_data_get_vector_size (plot->x_vals) - 1;
                }
                if (xyz->grid[1].data) {
                        if (xyz->base.y_vals)
                                g_object_unref (xyz->base.y_vals);
                        xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
-                       xyz->base.rows = go_data_get_vector_size (plot->y_vals);
+                       xyz->base.rows = go_data_get_vector_size (plot->y_vals) - 1;
                }
        } else {
-               GogXYZSurfacePlot *xyz = GOG_XYZ_SURFACE_PLOT (plot);
+               GogXYMatrixPlot *xyz = GOG_XY_MATRIX_PLOT (plot);
                if (xyz->grid[0].data) {
                        if (xyz->base.x_vals)
                                g_object_unref (xyz->base.x_vals);
                        xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
-                       xyz->base.columns = go_data_get_vector_size (plot->x_vals);
+                       xyz->base.columns = go_data_get_vector_size (plot->x_vals) - 1;
                }
                if (xyz->grid[1].data) {
                        if (xyz->base.y_vals)
                                g_object_unref (xyz->base.y_vals);
                        xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
-                       xyz->base.rows = go_data_get_vector_size (plot->y_vals);
+                       xyz->base.rows = go_data_get_vector_size (plot->y_vals) - 1;
+               }
+       }
+       n = plot->rows * plot->columns;
+       if (plot->rows < 2 || plot->columns < 2) {
+               /* we store the default value to avoid warnings about invalid values */
+               if (plot->rows < 2)
+                       ((GogXYZPlot *) plot)->rows = 10;
+               if (plot->columns < 2)
+                       ((GogXYZPlot *) plot)->columns = 10;
+               return NULL;
+       }
+       x_limits = go_range_sort (go_data_get_values (gog_xyz_plot_get_x_vals ((GogXYZPlot *) plot)), 
plot->columns + 1);
+       y_limits = go_range_sort (go_data_get_values (gog_xyz_plot_get_y_vals ((GogXYZPlot *) plot)), 
plot->rows + 1);
+       if (GOG_IS_XY_MATRIX_PLOT (plot)) {
+               kmax = gog_series_get_xy_data (GOG_SERIES (series), &x_vals, &y_vals);
+       } else
+               kmax = gog_series_get_xyz_data (GOG_SERIES (series),
+                                                        &x_vals, &y_vals, &z_vals);
+       /* sort the data by column and row */
+       raw_data.values[0] = x_vals;
+       raw_data.values[1] = y_vals;
+       raw_data.cur_series = 1;
+       sort = g_new0 (unsigned, kmax);
+       for (i = 0; i < kmax; i++)
+               sort[i] = i;
+       g_qsort_with_data (sort, kmax, sizeof (unsigned), (GCompareDataFunc) data_compare, &raw_data);
+       raw_data.cur_series = 0;
+       imax = plot->rows + 1;
+       jmax = plot->columns + 1;
+
+       data = g_new0 (double, n);
+       grid = g_new0 (unsigned, n);
+
+       l = index = 0;
+       while (l < kmax && y_vals[sort[l]] < y_limits[0])
+               l++;
+       k = l;
+       for (i = 1; i < imax; i++) {
+               while (l < kmax && y_vals[sort[l]] <= y_limits[i])
+                       l++;
+               g_qsort_with_data (sort + k, l - k, sizeof (unsigned), (GCompareDataFunc) data_compare, 
&raw_data);
+               while (k < l && x_vals[sort[k]] < x_limits[0])
+                       k++;
+               for (j = 1; j < jmax && k < l; j++) {
+                       index = (i - 1) * plot->columns + j - 1;
+                       while (k < l && x_vals[sort[k]] <= x_limits[j]) {
+                               if (G_LIKELY (index < n)) {
+                                       data[index] += (z_vals)? z_vals[sort[k]]: 1;
+                                       grid[index]++;
+                               }
+                               k++;
+                       }
+               }
+               k = l;
+       }
+       if (is_3d) {
+               for (k = 0; k < n; ++k) {
+                       if (grid[k] != 0)
+                               data[k] /= grid[k];
+                       else if (GOG_XYZ_MATRIX_PLOT (plot)->missing_as == XYZ_SURFACE_MISSING_AS_NAN)
+                               data[k] = go_nan;
+               }
+       } else if (GOG_XY_MATRIX_PLOT (plot)->as_density) {
+               double width, height[jmax];
+               for (j = 1; j < jmax; j++)
+                       height[j] = y_limits[j] - y_limits[j - 1];
+               for (i = 1; i < imax; i++) {
+                       width = x_limits[i] - x_limits[i - 1];
+                       for (j = 1; j < jmax; j++)
+                               data [(i - 1) * plot->columns + j - 1] /= width * height[j];
+               }
+       }
+       if (cardinality_changed != NULL)
+               *cardinality_changed = FALSE;
+       g_free (x_limits);
+       g_free (y_limits);
+       g_free (sort);
+       g_free (grid);
+
+       go_range_min (data, n, &((GogXYZPlot *) plot)->z.minima);
+       go_range_max (data, n, &((GogXYZPlot *) plot)->z.maxima);
+       return data;
+}
+
+static double *
+gog_xyz_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
+{
+       unsigned i, j, k, l, index;
+       GogSeries *series = GOG_SERIES (plot->base.series->data);
+       const double *x_vals, *y_vals, *z_vals = NULL;
+       double *x_limits, *y_limits, xmin, ymin;
+       double *data;
+       unsigned *grid, n, kmax, imax, jmax;
+       xyz_data raw_data;
+       unsigned *sort;
+       gboolean is_3d = GOG_PLOT (plot)->desc.series.num_dim == 3;
+       if (GOG_IS_CONTOUR_PLOT (plot)) {
+               if (is_3d) {
+                       GogXYZContourPlot *xyz = GOG_XYZ_CONTOUR_PLOT (plot);
+                       if (xyz->grid[0].data) {
+                               if (plot->x_vals)
+                                       g_object_unref (plot->x_vals);
+                               plot->x_vals = g_object_ref (xyz->grid[0].data);
+                               plot->columns = go_data_get_vector_size (plot->x_vals);
+                       }
+                       if (xyz->grid[1].data) {
+                               if (plot->y_vals)
+                                       g_object_unref (plot->y_vals);
+                               plot->y_vals = g_object_ref (xyz->grid[1].data);
+                               plot->rows = go_data_get_vector_size (plot->y_vals);
+                       }
+               } else {
+                       GogXYContourPlot *xyz = GOG_XY_CONTOUR_PLOT (plot);
+                       if (xyz->grid[0].data) {
+                               if (plot->x_vals)
+                                       g_object_unref (plot->x_vals);
+                               plot->x_vals = g_object_ref (xyz->grid[0].data);
+                               plot->columns = go_data_get_vector_size (plot->x_vals);
+                       }
+                       if (xyz->grid[1].data) {
+                               if (plot->y_vals)
+                                       g_object_unref (plot->y_vals);
+                               plot->y_vals = g_object_ref (xyz->grid[1].data);
+                               plot->rows = go_data_get_vector_size (plot->y_vals);
+                       }
+               }
+       } else {
+               if (is_3d) {
+                       GogXYZSurfacePlot *xyz = GOG_XYZ_SURFACE_PLOT (plot);
+                       if (xyz->grid[0].data) {
+                               if (xyz->base.x_vals)
+                                       g_object_unref (xyz->base.x_vals);
+                               xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
+                               xyz->base.columns = go_data_get_vector_size (plot->x_vals);
+                       }
+                       if (xyz->grid[1].data) {
+                               if (xyz->base.y_vals)
+                                       g_object_unref (xyz->base.y_vals);
+                               xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
+                               xyz->base.rows = go_data_get_vector_size (plot->y_vals);
+                       }
+               } else {
+                       GogXYSurfacePlot *xyz = GOG_XY_SURFACE_PLOT (plot);
+                       if (xyz->grid[0].data) {
+                               if (xyz->base.x_vals)
+                                       g_object_unref (xyz->base.x_vals);
+                               xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
+                               xyz->base.columns = go_data_get_vector_size (plot->x_vals);
+                       }
+                       if (xyz->grid[1].data) {
+                               if (xyz->base.y_vals)
+                                       g_object_unref (xyz->base.y_vals);
+                               xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
+                               xyz->base.rows = go_data_get_vector_size (plot->y_vals);
+                       }
                }
        }
        n = plot->rows * plot->columns;
@@ -153,15 +300,24 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
                return NULL;
        }
        x_limits = go_range_sort (go_data_get_values (gog_xyz_plot_get_x_vals ((GogXYZPlot *) plot)), 
plot->columns);
+       /* we now take a symetric interval around first bin */
+       xmin = (3. * x_limits[0] - x_limits[1]) / 2.;
        for (i = 0; i < plot->columns - 1; i++)
                x_limits[i] = (x_limits[i] + x_limits[i+1]) / 2.;
-       x_limits[i] = G_MAXDOUBLE;
+       /* we now take a symetric interval around last bin */
+       x_limits[i] = 2 * x_limits[i] - x_limits[i - 1];
        y_limits = go_range_sort (go_data_get_values (gog_xyz_plot_get_y_vals ((GogXYZPlot *) plot)), 
plot->rows);
+       /* another symetric interval */
+       ymin = (3. * y_limits[0] - y_limits[1]) / 2.;
        for (i = 0; i < plot->rows - 1; i++)
                y_limits[i] = (y_limits[i] + y_limits[i+1]) / 2.;
-       y_limits[i] = G_MAXDOUBLE;
-       kmax = gog_series_get_xyz_data (GOG_SERIES (series),
-                                                &x_vals, &y_vals, &z_vals);
+       /* still another symetric interval */
+       y_limits[i] = 2 * y_limits[i] - y_limits[i - 1];
+       if (GOG_PLOT (plot)->desc.series.num_dim == 3)
+               kmax = gog_series_get_xyz_data (GOG_SERIES (series),
+                                                        &x_vals, &y_vals, &z_vals);
+       else
+               kmax = gog_series_get_xy_data (GOG_SERIES (series), &x_vals, &y_vals);
        /* sort the data by column and row */
        raw_data.values[0] = x_vals;
        raw_data.values[1] = y_vals;
@@ -173,24 +329,25 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
        raw_data.cur_series = 0;
        imax = plot->rows;
        jmax = plot->columns;
-       xmin = plot->x.minima;
-       ymin = plot->y.minima;
-       xinc = (plot->x.maxima - xmin) / (jmax - 1);
-       yinc = (plot->y.maxima - ymin) / (imax - 1);
 
        data = g_new0 (double, n);
        grid = g_new0 (unsigned, n);
 
-       k = l = index = 0;
+       k = 0;
+       while (k < kmax && y_vals[sort[k]] < ymin)
+               k++;
+       l = k;
        for (i = 0; i < imax; i++) {
                while (l < kmax && y_vals[sort[l]] < y_limits[i])
                        l++;
                g_qsort_with_data (sort + k, l - k, sizeof (unsigned), (GCompareDataFunc) data_compare, 
&raw_data);
+               while (k < l && x_vals[sort[k]] < xmin)
+                       k++;
                for (j = 0; j < jmax && k < l; j++) {
                        index = i * jmax + j;
                        while (k < l && x_vals[sort[k]] < x_limits[j]) {
                                if (G_LIKELY (index < n)) {
-                                       data[index] += z_vals[sort[k]];
+                                       data[index] += (z_vals)? z_vals[sort[k]]: 1;
                                        grid[index]++;
                                }
                                k++;
@@ -199,13 +356,40 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
                k = l;
        }
 
-       for (k = 0; k < n; ++k)
-               if (grid[k] != 0)
-                       data[k] /= grid[k];
-               else if (GOG_IS_CONTOUR_PLOT (plot)?
-                               GOG_XYZ_CONTOUR_PLOT (plot)->missing_as == XYZ_SURFACE_MISSING_AS_NAN:
-                               GOG_XYZ_SURFACE_PLOT (plot)->missing_as == XYZ_SURFACE_MISSING_AS_NAN)
-                       data[k] = go_nan;
+       if (is_3d) {
+               for (k = 0; k < n; ++k)
+                       if (grid[k] != 0)
+                               data[k] /= grid[k];
+                       else if (GOG_IS_CONTOUR_PLOT (plot)?
+                                       GOG_XYZ_CONTOUR_PLOT (plot)->missing_as == XYZ_SURFACE_MISSING_AS_NAN:
+                                           GOG_XYZ_SURFACE_PLOT (plot)->missing_as == 
XYZ_SURFACE_MISSING_AS_NAN)
+                               data[k] = go_nan;
+       } else {
+               gboolean as_density;
+               g_object_get (G_OBJECT (plot), "as-density", &as_density, NULL);
+               if (as_density) {
+                       double width[imax], height[jmax];
+                       width[0] = x_limits[0] - xmin;
+                       for (i = 1; i < imax; i++)
+                               width[i] = x_limits[i] - x_limits[i - 1];
+                       height[0] = y_limits[0] - ymin;
+                       for (j = 1; j < jmax; j++)
+                               height[j] = y_limits[j] - y_limits[j - 1];
+                       for (i = 1; i < imax; i++) {
+                               for (j = 1; j < jmax; j++)
+                                       data [(i - 1) * plot->columns + j - 1] /= width[i] * height[j];
+                       }
+               }
+       }
+
+
+       g_free (x_limits);
+       g_free (y_limits);
+       g_free (sort);
+       g_free (grid);
+
+       go_range_min (data, n, &((GogXYZPlot *) plot)->z.minima);
+       go_range_max (data, n, &((GogXYZPlot *) plot)->z.maxima);
 
        if (GOG_IS_CONTOUR_PLOT (plot)) {
                GogAxisMap *map;
@@ -214,13 +398,13 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
                unsigned nticks;
                double *x, val, minimum, maximum, slope, offset = 0.;
                unsigned max;
+               gboolean has_scale = gog_axis_get_color_scale (axis) != NULL;
 
                if (!gog_axis_get_bounds (axis, &minimum, &maximum)) {
-                       series->num_elements = 2; /* series name and one slice */
-                       *cardinality_changed = TRUE;
-                       g_free (grid);
-                       g_free (data);
-                       return NULL;
+                       series->num_elements = has_scale? 1: 2; /* series name and one slice */
+                       if (cardinality_changed)
+                               *cardinality_changed = TRUE;
+                       return data;
                }
                nticks = gog_axis_get_ticks (axis, &zticks);
                map = gog_axis_map_new (axis, 0, 1);
@@ -265,37 +449,44 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
                        }
                        data[k] = val;
                }
-               if (series->num_elements != max) {
-                       series->num_elements = max;
-                       *cardinality_changed = TRUE;
+               if ((has_scale && series->num_elements != 1) || series->num_elements != max) {
+                       series->num_elements = has_scale? 1: max;
+                       if (cardinality_changed)
+                               *cardinality_changed = TRUE;
                }
                gog_axis_map_free (map);
                g_free (x);
                if (max < 2) { /* this might happen with bad 3d axis configuration */
                        g_free (data);
                        data = NULL;
-               }
-       } else
+               } else
+                       GOG_CONTOUR_PLOT (plot)->max_colors = max;
+       } else if (cardinality_changed != NULL)
                *cardinality_changed = FALSE;
-       g_free (x_limits);
-       g_free (y_limits);
-       g_free (sort);
-       g_free (grid);
+
        return data;
 }
 
 static char const *
 gog_xyz_contour_plot_type_name (G_GNUC_UNUSED GogObject const *item)
 {
-       /* xgettext : the base for how to name surface plot objects
+       /* xgettext : the base for how to name contour plot objects with (x,y,z) data
        */
        return N_("PlotXYZContour");
 }
 
 static char const *
+gog_xyz_matrix_plot_type_name (G_GNUC_UNUSED GogObject const *item)
+{
+       /* xgettext : the base for how to name matrix plot objects with (x,y,z) data
+       */
+       return N_("PlotXYZMatrix");
+}
+
+static char const *
 gog_xyz_surface_plot_type_name (G_GNUC_UNUSED GogObject const *item)
 {
-       /* xgettext : the base for how to name surface plot objects
+       /* xgettext : the base for how to name surface plot objects with (x,y,z) data
        */
        return N_("PlotXYZSurface");
 }
@@ -308,9 +499,7 @@ gog_xyz_surface_plot_populate_editor (GogObject *item,
                                  GogDataAllocator *dalloc,
                                  GOCmdContext *cc)
 {
-       GogObjectClass *klass = (GOG_IS_CONTOUR_PLOT (item))?
-                               plot_xyz_contour_parent_klass:
-                               plot_xyz_surface_parent_klass;
+       GObjectClass *klass = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
        GtkWidget *w = gog_xyz_surface_plot_pref (GOG_XYZ_PLOT (item), dalloc, cc);
        go_editor_add_page (editor, w, _("Properties"));
        g_object_unref (w);
@@ -325,9 +514,7 @@ gog_xyz_surface_plot_update (GogObject *obj)
        GogXYZPlot *model = GOG_XYZ_PLOT(obj);
        GogXYZSeries *series;
        double tmp_min, tmp_max;
-       GogObjectClass *klass = (GOG_IS_CONTOUR_PLOT (obj))?
-                               plot_xyz_contour_parent_klass:
-                               plot_xyz_surface_parent_klass;
+       GogObjectClass *klass = g_type_class_peek_parent (G_OBJECT_GET_CLASS (obj));
        if (model->base.series == NULL)
                return;
 
@@ -367,17 +554,18 @@ gog_xyz_surface_plot_update (GogObject *obj)
                model->y_vals = NULL;
        }
 
-       go_data_get_bounds (series->base.values[2].data, &tmp_min, &tmp_max);
-       if (!go_finite (tmp_min) || !go_finite (tmp_max) ||
-           tmp_min > tmp_max) {
-               tmp_min = 0;
-               tmp_max = go_data_get_vector_size (series->base.values[2].data);
-       } else if (model->z.fmt == NULL)
-               model->z.fmt = go_data_preferred_fmt (series->base.values[2].data);
-       model->z.date_conv = go_data_date_conv (series->base.values[2].data);
-       model->z.minima = tmp_min;
-       model->z.maxima = tmp_max;
-       gog_axis_bound_changed (model->base.axis[((GOG_IS_CONTOUR_PLOT (model))? GOG_AXIS_PSEUDO_3D: 
GOG_AXIS_Z)], GOG_OBJECT (model));
+       if (GOG_PLOT (model)->desc.series.num_dim > 2 && model->z.fmt == NULL)
+                       model->z.fmt = go_data_preferred_fmt (series->base.values[2].data);     
+       if (model->plotted_data != NULL)
+               g_free (model->plotted_data);
+       model->plotted_data = gog_xyz_plot_build_matrix (model, NULL);
+       if (model->plotted_data) {
+               gog_axis_bound_changed (model->base.axis[GOG_IS_CONTOUR_PLOT (model)?
+                                                        GOG_AXIS_PSEUDO_3D:
+                                                            (GOG_IS_MATRIX_PLOT (model)?
+                                                                 GOG_AXIS_COLOR: GOG_AXIS_Z)],
+                                           GOG_OBJECT (model));
+       }
 
        gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
        if (klass->update)
@@ -435,12 +623,20 @@ gog_xyz_surface_plot_set_property (GObject *obj, guint param_id,
                        plot->x_vals = NULL;
                }
                break;
-       case XYZ_SURFACE_PROP_MISSING_AS:
-               if (GOG_IS_CONTOUR_PLOT (plot))
+       case XYZ_SURFACE_PROP_EXTRA1:
+               if (GOG_IS_XYZ_CONTOUR_PLOT (plot))
                        GOG_XYZ_CONTOUR_PLOT (plot)->missing_as = missing_as_value (g_value_get_string 
(value));
-               else
+               else if (GOG_IS_XYZ_MATRIX_PLOT (plot))
+                       GOG_XYZ_MATRIX_PLOT (plot)->missing_as = missing_as_value (g_value_get_string 
(value));
+               else if (GOG_IS_XYZ_SURFACE_PLOT (plot))
                        GOG_XYZ_SURFACE_PLOT (plot)->missing_as = missing_as_value (g_value_get_string 
(value));
-                       gog_object_request_update (GOG_OBJECT (plot));
+               else if (GOG_IS_XY_CONTOUR_PLOT (plot))
+                       GOG_XY_CONTOUR_PLOT (plot)->as_density = g_value_get_boolean (value);
+               else if (GOG_IS_XY_MATRIX_PLOT (plot))
+                       GOG_XY_MATRIX_PLOT (plot)->as_density = g_value_get_boolean (value);
+               else
+                       GOG_XY_SURFACE_PLOT (plot)->as_density = g_value_get_boolean (value);
+               gog_object_request_update (GOG_OBJECT (plot));
                break;
 
        default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
@@ -468,10 +664,22 @@ gog_xyz_surface_plot_get_property (GObject *obj, guint param_id,
        case XYZ_SURFACE_PROP_AUTO_COLUMNS :
                g_value_set_boolean (value, plot->auto_x);
                break;
-       case XYZ_SURFACE_PROP_MISSING_AS :
-               g_value_set_string (value, missing_as_string (GOG_IS_CONTOUR_PLOT (plot)?
-                                                             GOG_XYZ_CONTOUR_PLOT (plot)->missing_as:
-                                                                 GOG_XYZ_SURFACE_PLOT (plot)->missing_as));
+       case XYZ_SURFACE_PROP_EXTRA1 :
+               if (GOG_PLOT (plot)->desc.series.num_dim == 2) {
+                       if (GOG_IS_CONTOUR_PLOT (plot))
+                               g_value_set_boolean (value, GOG_XY_CONTOUR_PLOT (plot)->as_density);
+                       else if (GOG_IS_MATRIX_PLOT (plot))
+                               g_value_set_boolean (value, GOG_XY_MATRIX_PLOT (plot)->as_density);
+                       else
+                               g_value_set_boolean (value, GOG_XY_SURFACE_PLOT (plot)->as_density);
+               } else {
+                       if (GOG_IS_CONTOUR_PLOT (plot))
+                               g_value_set_string (value, missing_as_string (GOG_XYZ_CONTOUR_PLOT 
(plot)->missing_as));
+                       else if (GOG_IS_MATRIX_PLOT (plot))
+                               g_value_set_string (value, missing_as_string (GOG_XYZ_MATRIX_PLOT 
(plot)->missing_as));
+                       else
+                               g_value_set_string (value, missing_as_string (GOG_XYZ_SURFACE_PLOT 
(plot)->missing_as));
+               }
                break;
 
        default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
@@ -488,7 +696,7 @@ gog_xyz_surface_finalize (GObject *obj)
 }
 
 static void
-common_init_class (GogXYZPlotClass *klass)
+common_init_class (GogXYZPlotClass *klass, gboolean is_3d)
 {
        GogPlotClass *gog_plot_klass = (GogPlotClass*) klass;
        GObjectClass *gobject_klass = (GObjectClass *) klass;
@@ -521,12 +729,43 @@ common_init_class (GogXYZPlotClass *klass)
                        _("Whether the columns limits should be evaluated"),
                        TRUE,
                        GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
-       g_object_class_install_property (gobject_klass, XYZ_SURFACE_PROP_MISSING_AS,
-               g_param_spec_string ("missing-as",
-                       _("Missing as"),
-                       _("How to deal with missing data"),
-                       "invalid",
-                       GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+       if (is_3d) {
+               g_object_class_install_property (gobject_klass, XYZ_SURFACE_PROP_EXTRA1,
+                       g_param_spec_string ("missing-as",
+                               _("Missing as"),
+                               _("How to deal with missing data"),
+                               "invalid",
+                               GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+               {
+                       static GogSeriesDimDesc dimensions[] = {
+                               { N_("X"), GOG_SERIES_REQUIRED, FALSE,
+                                 GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
+                               { N_("Y"), GOG_SERIES_REQUIRED, FALSE,
+                                 GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
+                               { N_("Z"), GOG_SERIES_REQUIRED, FALSE,
+                                 GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
+                       };
+                       gog_plot_klass->desc.series.dim = dimensions;
+                       gog_plot_klass->desc.series.num_dim = G_N_ELEMENTS (dimensions);
+               }
+       } else {
+               g_object_class_install_property (gobject_klass, XYZ_SURFACE_PROP_EXTRA1,
+                       g_param_spec_boolean ("as-density",
+                               _("As density"),
+                               _("Display the data as density instead or raw data"),
+                               TRUE,
+                               GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+               {
+                       static GogSeriesDimDesc dimensions[] = {
+                               { N_("X"), GOG_SERIES_REQUIRED, FALSE,
+                                 GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
+                               { N_("Y"), GOG_SERIES_REQUIRED, FALSE,
+                                 GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
+                       };
+                       gog_plot_klass->desc.series.dim = dimensions;
+                       gog_plot_klass->desc.series.num_dim = G_N_ELEMENTS (dimensions);
+               }
+       }
 
        gog_object_klass->update        = gog_xyz_surface_plot_update;
 
@@ -534,36 +773,30 @@ common_init_class (GogXYZPlotClass *klass)
        gog_object_klass->populate_editor       = gog_xyz_surface_plot_populate_editor;
 #endif
 
-       {
-               static GogSeriesDimDesc dimensions[] = {
-                       { N_("X"), GOG_SERIES_REQUIRED, FALSE,
-                         GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
-                       { N_("Y"), GOG_SERIES_REQUIRED, FALSE,
-                         GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
-                       { N_("Z"), GOG_SERIES_REQUIRED, FALSE,
-                         GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
-               };
-               gog_plot_klass->desc.series.dim = dimensions;
-               gog_plot_klass->desc.series.num_dim = G_N_ELEMENTS (dimensions);
-       }
-
-       klass->build_matrix = gog_xyz_surface_plot_build_matrix;
 }
 
 static void
 gog_xyz_contour_plot_class_init (GogXYZPlotClass *klass)
 {
-       plot_xyz_contour_parent_klass = g_type_class_peek_parent (klass);
        GOG_OBJECT_CLASS (klass)->type_name = gog_xyz_contour_plot_type_name;
-       common_init_class (klass);
+       common_init_class (klass, TRUE);
+       klass->build_matrix = gog_xyz_surface_plot_build_matrix;
+}
+
+static void
+gog_xyz_matrix_plot_class_init (GogXYZPlotClass *klass)
+{
+       GOG_OBJECT_CLASS (klass)->type_name = gog_xyz_matrix_plot_type_name;
+       common_init_class (klass, TRUE);
+       klass->build_matrix = gog_xyz_matrix_plot_build_matrix;
 }
 
 static void
 gog_xyz_surface_plot_class_init (GogXYZPlotClass *klass)
 {
-       plot_xyz_surface_parent_klass = g_type_class_peek_parent (klass);
        GOG_OBJECT_CLASS (klass)->type_name = gog_xyz_surface_plot_type_name;
-       common_init_class (klass);
+       common_init_class (klass, TRUE);
+       klass->build_matrix = gog_xyz_surface_plot_build_matrix;
 }
 
 static void
@@ -592,6 +825,15 @@ gog_xyz_contour_plot_dataset_get_elem (GogDataset const *set, int dim_i)
 }
 
 static GogDatasetElement *
+gog_xyz_matrix_plot_dataset_get_elem (GogDataset const *set, int dim_i)
+{
+       GogXYZMatrixPlot *plot = GOG_XYZ_MATRIX_PLOT (set);
+       g_return_val_if_fail (2 > dim_i, NULL);
+       g_return_val_if_fail (dim_i >= 0, NULL);
+       return plot->grid + dim_i;
+}
+
+static GogDatasetElement *
 gog_xyz_surface_plot_dataset_get_elem (GogDataset const *set, int dim_i)
 {
        GogXYZSurfacePlot *plot = GOG_XYZ_SURFACE_PLOT (set);
@@ -603,7 +845,8 @@ gog_xyz_surface_plot_dataset_get_elem (GogDataset const *set, int dim_i)
 static void
 gog_xyz_surface_plot_dataset_dim_changed (GogDataset *set, int dim_i)
 {
-       gog_object_request_update (GOG_OBJECT (set));
+       /* we need to update cardinality for contour plots */
+       gog_plot_request_cardinality_update (GOG_PLOT (set));
 }
 
 static void
@@ -615,6 +858,14 @@ gog_xyz_contour_plot_dataset_init (GogDatasetClass *iface)
 }
 
 static void
+gog_xyz_matrix_plot_dataset_init (GogDatasetClass *iface)
+{
+       iface->get_elem    = gog_xyz_matrix_plot_dataset_get_elem;
+       iface->dims        = gog_xyz_surface_plot_dataset_dims;
+       iface->dim_changed = gog_xyz_surface_plot_dataset_dim_changed;
+}
+
+static void
 gog_xyz_surface_plot_dataset_init (GogDatasetClass *iface)
 {
        iface->get_elem    = gog_xyz_surface_plot_dataset_get_elem;
@@ -627,7 +878,180 @@ GSF_DYNAMIC_CLASS_FULL (GogXYZContourPlot, gog_xyz_contour_plot,
         gog_xyz_surface_plot_init, GOG_TYPE_CONTOUR_PLOT, 0,
         GSF_INTERFACE (gog_xyz_contour_plot_dataset_init, GOG_TYPE_DATASET))
 
+GSF_DYNAMIC_CLASS_FULL (GogXYZMatrixPlot, gog_xyz_matrix_plot,
+       NULL, NULL, gog_xyz_matrix_plot_class_init, NULL,
+        gog_xyz_surface_plot_init, GOG_TYPE_MATRIX_PLOT, 0,
+        GSF_INTERFACE (gog_xyz_matrix_plot_dataset_init, GOG_TYPE_DATASET))
+
 GSF_DYNAMIC_CLASS_FULL (GogXYZSurfacePlot, gog_xyz_surface_plot,
        NULL, NULL, gog_xyz_surface_plot_class_init, NULL,
         gog_xyz_surface_plot_init, GOG_TYPE_SURFACE_PLOT, 0,
         GSF_INTERFACE (gog_xyz_surface_plot_dataset_init, GOG_TYPE_DATASET))
+
+/*-----------------------------------------------------------------------------
+ *
+ *  GogXYContourPlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static char const *
+gog_xy_contour_plot_type_name (G_GNUC_UNUSED GogObject const *item)
+{
+       /* xgettext : the base for how to name contour plot objects with (x,y) data
+       */
+       return N_("PlotXYMatrix");
+}
+
+static void
+gog_xy_contour_plot_class_init (GogXYZPlotClass *klass)
+{
+       GogObjectClass *gog_object_klass = (GogObjectClass *) klass;
+
+       common_init_class (klass, FALSE);
+       /* Fill in GogObject superclass values */
+       gog_object_klass->type_name     = gog_xy_contour_plot_type_name;
+
+       klass->build_matrix = gog_xyz_surface_plot_build_matrix;
+}
+
+static void
+gog_xy_contour_plot_init (GogXYMatrixPlot *plot)
+{
+       gog_xyz_surface_plot_init (&plot->base);
+       plot->as_density = TRUE;
+}
+
+static GogDatasetElement *
+gog_xy_contour_plot_dataset_get_elem (GogDataset const *set, int dim_i)
+{
+       GogXYContourPlot *plot = GOG_XY_CONTOUR_PLOT (set);
+       g_return_val_if_fail (2 > dim_i, NULL);
+       g_return_val_if_fail (dim_i >= 0, NULL);
+       return plot->grid + dim_i;
+}
+
+static void
+gog_xy_contour_plot_dataset_init (GogDatasetClass *iface)
+{
+       iface->get_elem    = gog_xy_contour_plot_dataset_get_elem;
+       iface->dims        = gog_xyz_surface_plot_dataset_dims;
+       iface->dim_changed = gog_xyz_surface_plot_dataset_dim_changed;
+}
+
+GSF_DYNAMIC_CLASS_FULL (GogXYContourPlot, gog_xy_contour_plot,
+       NULL, NULL, gog_xy_contour_plot_class_init, NULL,
+        gog_xy_contour_plot_init, GOG_TYPE_CONTOUR_PLOT, 0,
+        GSF_INTERFACE (gog_xy_contour_plot_dataset_init, GOG_TYPE_DATASET))
+
+/*-----------------------------------------------------------------------------
+ *
+ *  GogXYMatrixPlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static char const *
+gog_xy_matrix_plot_type_name (G_GNUC_UNUSED GogObject const *item)
+{
+       /* xgettext : the base for how to name matrix plot objects with (x,y) data
+       */
+       return N_("PlotXYMatrix");
+}
+
+static void
+gog_xy_matrix_plot_class_init (GogXYZPlotClass *klass)
+{
+       GogObjectClass *gog_object_klass = (GogObjectClass *) klass;
+
+       common_init_class (klass, FALSE);
+       /* Fill in GogObject superclass values */
+       gog_object_klass->type_name     = gog_xy_matrix_plot_type_name;
+
+       klass->build_matrix = gog_xyz_matrix_plot_build_matrix;
+}
+
+static void
+gog_xy_matrix_plot_init (GogXYMatrixPlot *plot)
+{
+       gog_xyz_surface_plot_init (&plot->base);
+       plot->as_density = TRUE;
+}
+
+static GogDatasetElement *
+gog_xy_matrix_plot_dataset_get_elem (GogDataset const *set, int dim_i)
+{
+       GogXYMatrixPlot *plot = GOG_XY_MATRIX_PLOT (set);
+       g_return_val_if_fail (2 > dim_i, NULL);
+       g_return_val_if_fail (dim_i >= 0, NULL);
+       return plot->grid + dim_i;
+}
+
+static void
+gog_xy_matrix_plot_dataset_init (GogDatasetClass *iface)
+{
+       iface->get_elem    = gog_xy_matrix_plot_dataset_get_elem;
+       iface->dims        = gog_xyz_surface_plot_dataset_dims;
+       iface->dim_changed = gog_xyz_surface_plot_dataset_dim_changed;
+}
+
+GSF_DYNAMIC_CLASS_FULL (GogXYMatrixPlot, gog_xy_matrix_plot,
+       NULL, NULL, gog_xy_matrix_plot_class_init, NULL,
+        gog_xy_matrix_plot_init, GOG_TYPE_MATRIX_PLOT, 0,
+        GSF_INTERFACE (gog_xy_matrix_plot_dataset_init, GOG_TYPE_DATASET))
+
+/*-----------------------------------------------------------------------------
+ *
+ *  GogXYSurfacePlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static char const *
+gog_xy_surface_plot_type_name (G_GNUC_UNUSED GogObject const *item)
+{
+       /* xgettext : the base for how to name surface plots objects with (x,y) data
+       */
+       return N_("PlotXYSurface");
+}
+
+static void
+gog_xy_surface_plot_class_init (GogXYZPlotClass *klass)
+{
+       GogObjectClass *gog_object_klass = (GogObjectClass *) klass;
+
+       common_init_class (klass, FALSE);
+       /* Fill in GogObject superclass values */
+       gog_object_klass->type_name     = gog_xy_surface_plot_type_name;
+
+       klass->build_matrix = gog_xyz_surface_plot_build_matrix;
+}
+
+static void
+gog_xy_surface_plot_init (GogXYMatrixPlot *plot)
+{
+       gog_xyz_surface_plot_init (&plot->base);
+       plot->as_density = TRUE;
+}
+
+static GogDatasetElement *
+gog_xy_surface_plot_dataset_get_elem (GogDataset const *set, int dim_i)
+{
+       GogXYSurfacePlot *plot = GOG_XY_SURFACE_PLOT (set);
+       g_return_val_if_fail (2 > dim_i, NULL);
+       g_return_val_if_fail (dim_i >= 0, NULL);
+       return plot->grid + dim_i;
+}
+
+static void
+gog_xy_surface_plot_dataset_init (GogDatasetClass *iface)
+{
+       iface->get_elem    = gog_xy_surface_plot_dataset_get_elem;
+       iface->dims        = gog_xyz_surface_plot_dataset_dims;
+       iface->dim_changed = gog_xyz_surface_plot_dataset_dim_changed;
+}
+
+GSF_DYNAMIC_CLASS_FULL (GogXYSurfacePlot, gog_xy_surface_plot,
+       NULL, NULL, gog_xy_surface_plot_class_init, NULL,
+        gog_xy_surface_plot_init, GOG_TYPE_SURFACE_PLOT, 0,
+        GSF_INTERFACE (gog_xy_surface_plot_dataset_init, GOG_TYPE_DATASET))
diff --git a/plugins/plot_surface/gog-xyz-surface.h b/plugins/plot_surface/gog-xyz-surface.h
index 2d94e99..09fe3f2 100644
--- a/plugins/plot_surface/gog-xyz-surface.h
+++ b/plugins/plot_surface/gog-xyz-surface.h
@@ -23,6 +23,7 @@
 #define GOG_XYZ_SURFACE_H
 
 #include "gog-contour.h"
+#include "gog-matrix.h"
 #include "gog-surface.h"
 
 G_BEGIN_DECLS
@@ -52,6 +53,29 @@ void  gog_xyz_contour_plot_register_type   (GTypeModule *module);
 
 /*-----------------------------------------------------------------------------
  *
+ * GogXYZMatrixPlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+
+typedef struct {
+       GogMatrixPlot base;
+       GogDatasetElement grid[2];       /* for preset cols and rows */
+       unsigned missing_as;
+} GogXYZMatrixPlot;
+typedef GogMatrixPlotClass GogXYZMatrixPlotClass;
+
+#define GOG_TYPE_XYZ_MATRIX_PLOT       (gog_xyz_matrix_plot_get_type ())
+#define GOG_XYZ_MATRIX_PLOT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_XYZ_MATRIX_PLOT, GogXYZMatrixPlot))
+#define GOG_IS_XYZ_MATRIX_PLOT(o)      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_XYZ_MATRIX_PLOT))
+
+GType gog_xyz_matrix_plot_get_type (void);
+
+void  gog_xyz_matrix_plot_register_type   (GTypeModule *module);
+
+/*-----------------------------------------------------------------------------
+ *
  * GogXYZSurfacePlot
  *
  *-----------------------------------------------------------------------------
@@ -72,6 +96,70 @@ GType gog_xyz_surface_plot_get_type (void);
 
 void  gog_xyz_surface_plot_register_type   (GTypeModule *module);
 
+/*-----------------------------------------------------------------------------
+ *
+ * GogXYContourPlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+
+typedef struct {
+       GogContourPlot base;
+       GogDatasetElement grid[2];       /* for preset cols and rows */
+       gboolean as_density;
+} GogXYContourPlot;
+typedef GogContourPlotClass GogXYContourPlotClass;
+
+#define GOG_TYPE_XY_CONTOUR_PLOT       (gog_xy_contour_plot_get_type ())
+#define GOG_XY_CONTOUR_PLOT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_XY_CONTOUR_PLOT, GogXYContourPlot))
+#define GOG_IS_XY_CONTOUR_PLOT(o)      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_XY_CONTOUR_PLOT))
+
+GType gog_xy_contour_plot_get_type (void);
+void  gog_xy_contour_plot_register_type   (GTypeModule *module);
+
+/*-----------------------------------------------------------------------------
+ *
+ * GogXYMatrixPlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+typedef struct {
+       GogMatrixPlot base;
+       GogDatasetElement grid[2];       /* for preset cols and rows */
+       gboolean as_density;
+} GogXYMatrixPlot;
+typedef GogMatrixPlotClass GogXYMatrixPlotClass;
+
+#define GOG_TYPE_XY_MATRIX_PLOT        (gog_xy_matrix_plot_get_type ())
+#define GOG_XY_MATRIX_PLOT(o)  (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_XY_MATRIX_PLOT, GogXYMatrixPlot))
+#define GOG_IS_XY_MATRIX_PLOT(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_XY_MATRIX_PLOT))
+
+GType gog_xy_matrix_plot_get_type (void);
+void  gog_xy_matrix_plot_register_type   (GTypeModule *module);
+
+/*-----------------------------------------------------------------------------
+ *
+ * GogXYSurfacePlot
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+typedef struct {
+       GogSurfacePlot base;
+       GogDatasetElement grid[2];       /* for preset cols and rows */
+       gboolean as_density;
+} GogXYSurfacePlot;
+typedef GogSurfacePlotClass GogXYSurfacePlotClass;
+
+#define GOG_TYPE_XY_SURFACE_PLOT       (gog_xy_surface_plot_get_type ())
+#define GOG_XY_SURFACE_PLOT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_XY_SURFACE_PLOT, GogXYSurfacePlot))
+#define GOG_IS_XY_SURFACE_PLOT(o)      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_XY_SURFACE_PLOT))
+
+GType gog_xy_surface_plot_get_type (void);
+void  gog_xy_surface_plot_register_type   (GTypeModule *module);
+
 G_END_DECLS
 
 #endif /* GOG_XYZ_SURFACE_H */
diff --git a/plugins/plot_surface/gog-xyz.c b/plugins/plot_surface/gog-xyz.c
index da17afe..e546bd1 100644
--- a/plugins/plot_surface/gog-xyz.c
+++ b/plugins/plot_surface/gog-xyz.c
@@ -22,6 +22,7 @@
 #include <goffice/goffice-config.h>
 #include "gog-xyz.h"
 #include "gog-contour.h"
+#include "gog-matrix.h"
 #include "gog-surface.h"
 #include "gog-xyz-surface.h"
 #include "xl-surface.h"
@@ -61,7 +62,7 @@ static GogObjectClass *plot_xyz_parent_klass;
  **/
 
 double *
-gog_xyz_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_changed)
+gog_xyz_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
 {
        GogXYZPlotClass *klass = GOG_XYZ_PLOT_GET_CLASS (plot);
        return klass->build_matrix (plot, cardinality_changed);
@@ -115,6 +116,8 @@ gog_xyz_plot_get_x_vals (GogXYZPlot *plot)
        if (plot->data_xyz) {
                if (plot->x_vals == NULL) {
                        imax = plot->columns;
+                       if (GOG_IS_MATRIX_PLOT (plot))
+                               imax++;
                        inc = (plot->x.maxima - plot->x.minima) / (imax - 1);
                        vals = g_new (double, imax);
                        for (i = 0; i < imax; ++i)
@@ -137,6 +140,8 @@ gog_xyz_plot_get_y_vals (GogXYZPlot *plot)
        if (plot->data_xyz) {
                if (plot->y_vals == NULL) {
                        imax = plot->rows;
+                       if (GOG_IS_MATRIX_PLOT (plot))
+                               imax++;
                        inc = (plot->y.maxima - plot->y.minima) / (imax - 1);
                        vals = g_new (double, imax);
                        for (i = 0; i < imax; ++i)
@@ -438,7 +443,7 @@ static void
 gog_xyz_series_update (GogObject *obj)
 {
        GogXYZSeries *series = GOG_XYZ_SERIES (obj);
-       GODataMatrixSize size, old_size;
+       GODataMatrixSize size;
        GOData *mat;
        GOData *vec;
        int length;
@@ -451,8 +456,6 @@ gog_xyz_series_update (GogObject *obj)
                                                                     &x_vals, &y_vals, &z_vals);
        } else {
                if (series->base.values[2].data != NULL) {
-                       old_size.rows = series->rows;
-                       old_size.columns = series->columns;
                        mat = series->base.values[2].data;
                        go_data_get_values (mat);
                        go_data_get_matrix_size (mat, &size.rows, &size.columns);
@@ -461,6 +464,8 @@ gog_xyz_series_update (GogObject *obj)
                        vec = series->base.values[0].data;
                        go_data_get_values (vec);
                        length = go_data_get_vector_size (vec);
+                       if (GOG_IS_MATRIX_PLOT (series->base.plot) && length > 0)
+                               length--;
                        if (length < size.columns)
                                size.columns = length;
                }
@@ -468,6 +473,8 @@ gog_xyz_series_update (GogObject *obj)
                        vec = series->base.values[1].data;
                        go_data_get_values (vec);
                        length = go_data_get_vector_size (vec);
+                       if (GOG_IS_MATRIX_PLOT (series->base.plot) && length > 0)
+                               length--;
                        if (length < size.rows)
                                size.rows = length;
                }
@@ -477,7 +484,6 @@ gog_xyz_series_update (GogObject *obj)
 
        /* queue plot for redraw */
        gog_object_request_update (GOG_OBJECT (series->base.plot));
-/*     gog_plot_request_cardinality_update (series->base.plot);*/
 
        if (series_parent_klass->base.update)
                series_parent_klass->base.update (obj);
@@ -487,6 +493,8 @@ static void
 gog_xyz_series_init_style (GogStyledObject *gso, GOStyle *style)
 {
        series_parent_klass->init_style (gso, style);
+       if (GOG_IS_MATRIX_PLOT (GOG_SERIES (gso)->plot) && style->line.auto_dash)
+               style->line.dash_type = GO_LINE_NONE;
 }
 
 static void
@@ -513,11 +521,17 @@ go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
        gog_xyz_plot_register_type (module);
        gog_contour_plot_register_type (module);
        gog_contour_view_register_type (module);
+       gog_matrix_plot_register_type (module);
+       gog_matrix_view_register_type (module);
        gog_surface_plot_register_type (module);
        gog_surface_view_register_type (module);
        gog_xyz_contour_plot_register_type (module);
+       gog_xyz_matrix_plot_register_type (module);
        gog_xyz_surface_plot_register_type (module);
        gog_xyz_series_register_type (module);
+       gog_xy_contour_plot_register_type (module);
+       gog_xy_matrix_plot_register_type (module);
+       gog_xy_surface_plot_register_type (module);
        xl_xyz_series_register_type (module);
        xl_contour_plot_register_type (module);
        xl_surface_plot_register_type (module);
diff --git a/plugins/plot_surface/gog-xyz.h b/plugins/plot_surface/gog-xyz.h
index db4f5b6..72e8720 100644
--- a/plugins/plot_surface/gog-xyz.h
+++ b/plugins/plot_surface/gog-xyz.h
@@ -60,14 +60,14 @@ typedef struct {
 
        GogAxisType third_axis;
 
-       double * (*build_matrix) (GogXYZPlot const *plot, gboolean *cardinality_changed);
+       double * (*build_matrix) (GogXYZPlot *plot, gboolean *cardinality_changed);
        GOData * (*get_x_vals) (GogXYZPlot *plot);
        GOData * (*get_y_vals) (GogXYZPlot *plot);
 } GogXYZPlotClass;
 
 #define GOG_XYZ_PLOT_GET_CLASS(o)      (G_TYPE_INSTANCE_GET_CLASS ((o), GOG_TYPE_XYZ_PLOT, GogXYZPlotClass))
 
-double *gog_xyz_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_changed);
+double *gog_xyz_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed);
 GOData *gog_xyz_plot_get_x_vals (GogXYZPlot *plot);
 GOData *gog_xyz_plot_get_y_vals (GogXYZPlot *plot);
 
diff --git a/plugins/plot_surface/matrix.xpm b/plugins/plot_surface/matrix.xpm
new file mode 100644
index 0000000..a60dbb7
--- /dev/null
+++ b/plugins/plot_surface/matrix.xpm
@@ -0,0 +1,29 @@
+/* XPM */
+static char * matrix_xpm[] = {
+"18 18 8 1",
+"      c None",
+".     c #FF0000",
+"+     c #FF8C00",
+"@     c #FFFF00",
+"#     c #00FF00",
+"$     c #00FFFF",
+"%     c #0000FF",
+"&     c #9B009B",
+"                  ",
+" ....++++@@@@#### ",
+" ....++++@@@@#### ",
+" ....++++@@@@#### ",
+" ....++++@@@@#### ",
+" ++++@@@@####$$$$ ",
+" ++++@@@@####$$$$ ",
+" ++++@@@@####$$$$ ",
+" ++++@@@@####$$$$ ",
+" @@@@####$$$$%%%% ",
+" @@@@####$$$$%%%% ",
+" @@@@####$$$$%%%% ",
+" @@@@####$$$$%%%% ",
+" ####$$$$%%%%&&&& ",
+" ####$$$$%%%%&&&& ",
+" ####$$$$%%%%&&&& ",
+" ####$$$$%%%%&&&& ",
+"                  "};
diff --git a/plugins/plot_surface/plot-types.xml.in b/plugins/plot_surface/plot-types.xml.in
index f5f1205..bd7067e 100644
--- a/plugins/plot_surface/plot-types.xml.in
+++ b/plugins/plot_surface/plot-types.xml.in
@@ -2,6 +2,7 @@
 <Types xmlns:graph="http://www.gnumeric.org/graph_v2.dtd";>
        <Family _name="Contour" sample_image_file="res:go:plot_surface/contour.xpm" axis_set="pseudo-3d"/>
        <Family _name="Surface" sample_image_file="res:go:plot_surface/surface.xpm" axis_set="xyz"/>
+       <Family _name="Matrix"  sample_image_file="res:go:plot_surface/matrix.xpm" axis_set="xy-color"/>
 
        <Type _name="Contour" row="1" col="1"
                engine="GogContourPlot" family="Contour"
@@ -13,6 +14,11 @@
                _description="Builds a contour from a set of points with three coordinates"
                sample_image_file="res:go:plot_surface/chart_contour_2_1.png">
        </Type>
+       <Type _name="XYContour" row="1" col="3"
+               engine="GogXYContourPlot" family="Contour"
+               _description="Builds a contour from the number of (X,Y) values around each vertex"
+               sample_image_file="res:go:plot_surface/chart_contour_2_2.png">
+       </Type>
        <Type _name="Surface" row="1" col="1"
                engine="GogSurfacePlot" family="Surface"
                _description="Surface plot."
@@ -23,4 +29,24 @@
                _description="Builds a surface from a set of points with three coordinates"
                sample_image_file="res:go:plot_surface/chart_surface_2_2.png">
        </Type>
+       <Type _name="XYSurface" row="1" col="3"
+               engine="GogXYSurfacePlot" family="Surface"
+               _description="Builds a surface from the number of (X,Y) values around each vertex"
+               sample_image_file="res:go:plot_surface/chart_surface_2_3.png">
+       </Type>
+       <Type _name="Matrix" row="1" col="1"
+               engine="GogMatrixPlot" family="Matrix"
+               _description="Matrix plot. Displays as colors the values given as a matrix."
+               sample_image_file="res:go:plot_surface/chart_matrix_1_1.png">
+       </Type>
+       <Type _name="XYZMatrix" row="1" col="2"
+               engine="GogXYZMatrixPlot" family="Matrix"
+               _description="Displays as colors the mean Z values of the (X,Y,Z) data in each cell."
+               sample_image_file="res:go:plot_surface/chart_matrix_1_2.png">
+       </Type>
+       <Type _name="XYMatrix" row="1" col="3"
+               engine="GogXYMatrixPlot" family="Matrix"
+               _description="Displays as colors the number of (X,Y) values in each cell."
+               sample_image_file="res:go:plot_surface/chart_matrix_1_3.png">
+       </Type>
 </Types>
diff --git a/plugins/plot_surface/plugin.xml.in b/plugins/plot_surface/plugin.xml.in
index 83c0ca7..a053b17 100644
--- a/plugins/plot_surface/plugin.xml.in
+++ b/plugins/plot_surface/plugin.xml.in
@@ -14,6 +14,9 @@
                <service type="resource"
                         id="go:plot_surface/contour.xpm"
                         file="contour.xpm"/>
+               <service type="resource"
+                        id="go:plot_surface/matrix.xpm"
+                        file="matrix.xpm"/>
 
                <service type="plot_engine" id="GogContourPlot">
                        <information>
@@ -30,6 +33,11 @@
                                <_description>XYZ contour plotting engine</_description>
                        </information>
                </service>
+               <service type="plot_engine" id="GogXYContourPlot">
+                       <information>
+                               <_description>XY contour plotting engine</_description>
+                       </information>
+               </service>
                <service type="plot_engine" id="GogSurfacePlot">
                        <information>
                                <_description>Surface plotting engine</_description>
@@ -45,6 +53,26 @@
                                <_description>XYZ surface plotting engine</_description>
                        </information>
                </service>
+               <service type="plot_engine" id="GogXYSurfacePlot">
+                       <information>
+                               <_description>XY surface plotting engine</_description>
+                       </information>
+               </service>
+               <service type="plot_engine" id="GogMatrixPlot">
+                       <information>
+                               <_description>Matrix plotting engine</_description>
+                       </information>
+               </service>
+               <service type="plot_engine" id="GogXYMatrixPlot">
+                       <information>
+                               <_description>XY matrix plotting engine</_description>
+                       </information>
+               </service>
+               <service type="plot_engine" id="GogXYZMatrixPlot">
+                       <information>
+                               <_description>XYZ matrix plotting engine</_description>
+                       </information>
+               </service>
                <service type="plot_type" id="surface">
                        <file>plot-types.xml</file>
                        <information>
diff --git a/plugins/plot_surface/xl-surface.c b/plugins/plot_surface/xl-surface.c
index 3e6a9a4..be92b8a 100644
--- a/plugins/plot_surface/xl-surface.c
+++ b/plugins/plot_surface/xl-surface.c
@@ -209,8 +209,7 @@ static GogObjectClass *xl_contour_parent_klass;
 typedef GogContourPlotClass XLContourPlotClass;
 
 static double *
-xl_contour_plot_build_matrix (GogXYZPlot const *plot,
-                       gboolean *cardinality_changed)
+xl_contour_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
 {
        unsigned i, j, length;
        GogAxisMap *map;
@@ -224,6 +223,7 @@ xl_contour_plot_build_matrix (GogXYZPlot const *plot,
        double *data, minimum, maximum;
        unsigned max;
        GSList *ptr;
+       gboolean has_scale = gog_axis_get_color_scale (axis) != NULL;
 
        if (!gog_axis_get_bounds (axis, &minimum, &maximum))
                return NULL;
@@ -266,8 +266,8 @@ xl_contour_plot_build_matrix (GogXYZPlot const *plot,
        g_return_val_if_fail (series != NULL, NULL);
        max = (unsigned) ceil (1 / x[1]);
        series = plot->base.series->data;
-       if (series->num_elements != max) {
-               series->num_elements = max;
+       if ((has_scale && series->num_elements != 1) || series->num_elements != max) {
+               series->num_elements = has_scale? 1: max;
                *cardinality_changed = TRUE;
        }
        gog_axis_map_free (map);
@@ -333,8 +333,7 @@ static GogObjectClass *xl_surface_parent_klass;
 typedef GogSurfacePlotClass XLSurfacePlotClass;
 
 static double *
-xl_surface_plot_build_matrix (GogXYZPlot const *plot,
-                       gboolean *cardinality_changed)
+xl_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_changed)
 {
        unsigned i, j, length;
        double val;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]