Skip to content

Commit

Permalink
Set feature importances chart axis minimum to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
acrellin committed Jan 30, 2018
1 parent bc05eb6 commit 08e2c51
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions static/js/components/FeatureImportances.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { HorizontalBar } from 'react-chartjs-2';
const FeatureImportancesBarchart = props => {
const sorted_features = Object.keys(props.data).sort(
(a, b) => props.data[b] - props.data[a]).slice(0, 15);
const values = sorted_features.map(
feature => props.data[feature].toFixed(3));
const values = sorted_features.map(feature => props.data[feature]);
const data = {
labels: sorted_features,
datasets: [
Expand All @@ -18,10 +17,19 @@ const FeatureImportancesBarchart = props => {
}
]
};
const options = {
scales: {
xAxes: [{
ticks: {
min: 0.0
}
}]
}
};

return (
<div style={{ height: 300, width: 600 }}>
<HorizontalBar data={data} />
<HorizontalBar data={data} options={options} />
</div>
);
};
Expand Down

0 comments on commit 08e2c51

Please sign in to comment.