Created
March 16, 2019 14:04
-
-
Save NMZivkovic/fb39cf69db5e24ec203fd79fc86655b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @desc plots one | |
* @param array values - array of values | |
* @param string name - name of the plot | |
* @param string xoutput - x name | |
* @param string youtput - y name | |
*/ | |
function singlePlot(values, name, xoutput, youtput) | |
{ | |
tfvis.render.scatterplot( | |
{name: name}, | |
{values}, | |
{ | |
xoutput: xoutput, | |
youtput: youtput, | |
height: 300 | |
} | |
); | |
} | |
/** | |
* @desc plots one | |
* @param json data - complete json that contains wine quality data | |
*/ | |
function displayDataFunction(data){ | |
let displayData = data.map(d => ({ | |
x: d.alcohol, | |
y: d.quality, | |
})); | |
singlePlot(displayData, 'Alchocol v Quality', 'Alchocol', 'Quality') | |
displayData = data.map(d => ({ | |
x: d.chlorides, | |
y: d.quality, | |
})); | |
singlePlot(displayData, 'Chlorides v Quality', 'Chlorides', 'Quality') | |
displayData = data.map(d => ({ | |
x: d.citric_acid, | |
y: d.quality, | |
})); | |
singlePlot(displayData, 'Citric Acid v Quality', 'Citric Acid', 'Quality') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment