[goffice] Skip invalid data in probability plots.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Skip invalid data in probability plots.
- Date: Fri, 23 Apr 2010 15:32:08 +0000 (UTC)
commit 0f591eb871fdc7a12a96d53f344b9646446274a4
Author: Jean Brefort <jean brefort normalesup org>
Date: Fri Apr 23 17:34:46 2010 +0200
Skip invalid data in probability plots.
ChangeLog | 5 +++++
plugins/plot_distrib/gog-probability-plot.c | 14 ++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index beeb5c6..ff4f907 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-23 Jean Brefort <jean brefort normalesup org>
+
+ * plugins/plot_distrib/gog-probability-plot.c
+ (gog_probability_plot_series_update): skip invalid data.
+
2010-04-21 Morten Welinder <terra gnome org>
* goffice/utils/datetime.c (go_date_weeknum): Return the Excel
diff --git a/plugins/plot_distrib/gog-probability-plot.c b/plugins/plot_distrib/gog-probability-plot.c
index 39a4308..57fc885 100644
--- a/plugins/plot_distrib/gog-probability-plot.c
+++ b/plugins/plot_distrib/gog-probability-plot.c
@@ -518,10 +518,20 @@ gog_probability_plot_series_update (GogObject *obj)
g_free (series->x);
series->x = NULL;
if (series->base.values[0].data != NULL) {
+ double *x;
+ unsigned i, max = 0;
x_vals = go_data_get_values (series->base.values[0].data);
series->base.num_elements = go_data_get_vector_size (series->base.values[0].data);
- if (x_vals)
- series->x = go_range_sort (x_vals, series->base.num_elements);
+ if (x_vals) {
+ x = g_new (double, series->base.num_elements);
+ for (i = 0; i < series->base.num_elements; i++) {
+ if (go_finite (x_vals[i]))
+ x[max++] = x_vals[i];
+ }
+ series->base.num_elements = max;
+ series->x = go_range_sort (x, series->base.num_elements);
+ g_free (x);
+ }
}
mn = pow (0.5, 1. / series->base.num_elements);
d = series->base.num_elements + .365;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]