/*
PSPP - a program for statistical analysis.
- Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2012, 2013, 2015 Free Software Foundation, Inc.
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
}
- scatterplot = scatterplot_create(input,
- cmd->dep_vars[0],
- cmd->dep_vars[1],
- cmd->byvar,
- &byvar_overflow,
- ds_cstr (&title),
- cmd->es[0].minimum, cmd->es[0].maximum,
- cmd->es[1].minimum, cmd->es[1].maximum);
- scatterplot_chart_submit(scatterplot);
- ds_destroy(&title);
+ scatterplot = scatterplot_create (input,
+ cmd->dep_vars[0],
+ cmd->dep_vars[1],
+ cmd->byvar,
+ &byvar_overflow,
+ ds_cstr (&title),
+ cmd->es[0].minimum, cmd->es[0].maximum,
+ cmd->es[1].minimum, cmd->es[1].maximum);
+ scatterplot_chart_submit (scatterplot);
+ ds_destroy (&title);
if (byvar_overflow)
{
msg (MW, _("Maximum number of scatterplot categories reached."
"Your BY variable has too many distinct values."
- "The colouring of the plot will not be correct"));
+ "The coloring of the plot will not be correct"));
}
{
const struct variable *var = cmd->dep_vars[0];
const double x = case_data (c, var)->f;
- const double weight = dict_get_case_weight(cmd->dict,c,NULL);
+ const double weight = dict_get_case_weight (cmd->dict,c,NULL);
moments_pass_two (cmd->es[0].mom, x, weight);
histogram_add (histogram, x, weight);
}
- casereader_destroy(reader);
+ casereader_destroy (reader);
{
ds_cstr (&label), n, mean,
sqrt (var), false));
- statistic_destroy(&histogram->parent);
+ statistic_destroy (&histogram->parent);
ds_destroy (&label);
}
}
struct casereader *reader;
- cmd->es = pool_calloc(cmd->pool,cmd->n_dep_vars,sizeof(struct exploratory_stats));
+ cmd->es = pool_calloc (cmd->pool,cmd->n_dep_vars,sizeof(struct exploratory_stats));
for(int v=0;v<cmd->n_dep_vars;v++)
{
cmd->es[v].mom = moments_create (MOMENT_KURTOSIS);
for (reader = casereader_clone (input);
(c = casereader_read (reader)) != NULL; case_unref (c))
{
- const double weight = dict_get_case_weight(cmd->dict,c,NULL);
+ const double weight = dict_get_case_weight (cmd->dict,c,NULL);
for(int v=0;v<cmd->n_dep_vars;v++)
{
const struct variable *var = cmd->dep_vars[v];
switch (cmd->chart_type)
{
case CT_HISTOGRAM:
- reader = casereader_clone(input);
- show_histogr(cmd,reader);
- casereader_destroy(reader);
+ reader = casereader_clone (input);
+ show_histogr (cmd,reader);
+ casereader_destroy (reader);
break;
case CT_SCATTERPLOT:
- reader = casereader_clone(input);
- show_scatterplot(cmd,reader);
- casereader_destroy(reader);
+ reader = casereader_clone (input);
+ show_scatterplot (cmd,reader);
+ casereader_destroy (reader);
break;
default:
NOT_REACHED ();
break;
};
- casereader_destroy(input);
+ casereader_destroy (input);
cleanup_exploratory_stats (cmd);
}
{
lex_match (lexer, T_SLASH);
- if (lex_match_id(lexer, "HISTOGRAM"))
+ if (lex_match_id (lexer, "HISTOGRAM"))
{
if (graph.chart_type != CT_NONE)
{
- lex_error(lexer, _("Only one chart type is allowed."));
+ lex_error (lexer, _("Only one chart type is allowed."));
goto error;
}
if (!lex_force_match (lexer, T_EQUALS))
goto error;
if (graph.n_dep_vars > 1)
{
- lex_error(lexer, _("Only one variable is allowed"));
+ lex_error (lexer, _("Only one variable is allowed."));
goto error;
}
}
{
if (graph.chart_type != CT_NONE)
{
- lex_error(lexer, _("Only one chart type is allowed."));
+ lex_error (lexer, _("Only one chart type is allowed."));
goto error;
}
graph.chart_type = CT_SCATTERPLOT;
}
else if (lex_match_id (lexer, "OVERLAY"))
{
- lex_error(lexer, _("%s is not yet implemented."),"OVERLAY");
+ lex_error (lexer, _("%s is not yet implemented."),"OVERLAY");
goto error;
}
else if (lex_match_id (lexer, "MATRIX"))
{
- lex_error(lexer, _("%s is not yet implemented."),"MATRIX");
+ lex_error (lexer, _("%s is not yet implemented."),"MATRIX");
goto error;
}
else if (lex_match_id (lexer, "XYZ"))
}
else
{
- lex_error_expecting(lexer, "BIVARIATE", NULL);
+ lex_error_expecting (lexer, "BIVARIATE", NULL);
goto error;
}
if (!lex_force_match (lexer, T_RPAREN))
if (graph.scatter_type == ST_BIVARIATE && graph.n_dep_vars != 1)
{
- lex_error(lexer, _("Only one variable allowed"));
+ lex_error(lexer, _("Only one variable is allowed."));
goto error;
}
if (graph.scatter_type == ST_BIVARIATE && graph.n_dep_vars != 2)
{
- lex_error(lexer, _("Only one variable allowed"));
+ lex_error (lexer, _("Only one variable is allowed."));
goto error;
}
- if (lex_match(lexer, T_BY))
+ if (lex_match (lexer, T_BY))
{
const struct variable *v = NULL;
if (!lex_match_variable (lexer,graph.dict,&v))
{
- lex_error(lexer, _("Variable expected"));
+ lex_error (lexer, _("Variable expected"));
goto error;
}
graph.byvar = v;
if (graph.chart_type == CT_NONE)
{
- lex_error_expecting(lexer,"HISTOGRAM","SCATTERPLOT",NULL);
+ lex_error_expecting (lexer,"HISTOGRAM","SCATTERPLOT",NULL);
goto error;
}
const struct xrchart_colour *colour;
if (spc->byvar)
- byvar_width = var_get_width(spc->byvar);
+ byvar_width = var_get_width (spc->byvar);
- xrchart_write_xscale (cr, geom,
- spc->x_min,
- spc->x_max);
+ xrchart_write_xscale (cr, geom, spc->x_min, spc->x_max);
xrchart_write_yscale (cr, geom, spc->y_min, spc->y_max);
xrchart_write_title (cr, geom, _("Scatterplot %s"), chart_item->title);
xrchart_write_xlabel (cr, geom, var_to_string(spc->xvar));
{
if (spc->byvar)
{
- const union value *val = case_data(c,spc->byvar);
- for(i=0;i<n_catvals && !value_equal(&catvals[i],val,byvar_width);i++);
+ const union value *val = case_data (c,spc->byvar);
+ for(i=0;i<n_catvals && !value_equal (&catvals[i],val,byvar_width);i++);
if (i == n_catvals) /* No entry found */
{
if (n_catvals < MAX_PLOT_CATS)
{
struct string label;
- ds_init_empty(&label);
- if (var_is_value_missing(spc->byvar,val,MV_ANY))
- ds_put_cstr(&label,"missing");
+ ds_init_empty (&label);
+ if (var_is_value_missing (spc->byvar,val,MV_ANY))
+ ds_put_cstr (&label,"missing");
else
- var_append_value_name(spc->byvar,val,&label);
- value_clone(&catvals[n_catvals++],val,byvar_width);
+ var_append_value_name (spc->byvar,val,&label);
+ value_clone (&catvals[n_catvals++],val,byvar_width);
geom->n_datasets++;
geom->dataset = xrealloc (geom->dataset,
geom->n_datasets * sizeof (*geom->dataset));
- geom->dataset[geom->n_datasets - 1] = strdup(ds_cstr(&label));
- ds_destroy(&label);
+ geom->dataset[geom->n_datasets - 1] = strdup (ds_cstr(&label));
+ ds_destroy (&label);
}
else /* Use the last plot category */
{
}
}
}
- colour = &data_colour [ i % XRCHART_N_COLOURS];
+ colour = &data_colour[i % XRCHART_N_COLOURS];
cairo_set_source_rgb (cr,
colour->red / 255.0,
colour->green / 255.0,
case_data (c, spc->yvar)->f);
}
casereader_destroy (data);
- cairo_restore(cr);
+ cairo_restore (cr);
for(i=0;i<n_catvals;i++)
- value_destroy(&catvals[i],byvar_width);
+ value_destroy (&catvals[i],byvar_width);
if (spc->byvar)
- xrchart_write_legend(cr, geom);
-
-
-
- // xrchart_line (cr, geom, npp->slope, npp->intercept,
- // npp->y_first, npp->y_last, XRCHART_DIM_Y);
+ xrchart_write_legend (cr, geom);
}