Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up Cluster plotting #174

Open
drbenvincent opened this issue Feb 4, 2017 · 0 comments
Open

clean up Cluster plotting #174

drbenvincent opened this issue Feb 4, 2017 · 0 comments

Comments

@drbenvincent
Copy link
Owner

drbenvincent commented Feb 4, 2017

In Parametric.m we have some code with a long set of arguments passed in...

clusterPlot(...
    obj.coda,...
    obj.data,...
    [1 0 0],...
    obj.modelFilename,...
    obj.plotOptions,...
    obj.varList.discountFunctionParams)

meaning the the function signature has many entries

function clusterPlot(mcmcContainer, data, col, modelType, plotOptions, vars)
varNames = {vars.name};
if numel(varNames) == 1
	plot1Dclusters(mcmcContainer, data, col, modelType, plotOptions, vars);
elseif numel(varNames) == 2
	plot2Dclusters(mcmcContainer, data, col, modelType, plotOptions, vars);
else
	error('can only deal with plotting univariate or bivariate distributions')
end
end

which in turn means we are passing these values down yet again into plot1Dclusters.m or plot1Dclusters.m

Solutions

  1. Inversion of control. ie create a clusterPlot function with the arguments included (using partials)
  2. Polymorphism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant