<commit_before>var data = d3.csv("../data/QueryResults.csv")
	.row(function(d) { return {UserId: +d.UserId, Questions: +d.Questions, Answers: +d.Answers, Reputation: +d.Reputation}; }); //+ converts the string to a number and is faster than parsing

	
	
var margin = {top: 20, right: 40, bottom: 30, left: 60},
    width = 960 - margin.left - margin.right,
    height = 600 - margin.top - margin.bottom;

var x = d3.scale.linear()
    .range([0, width]);

var y = d3.scale.linear()
    .range([height, 0]);

var size = d3.scale.linear()
	.range([1, 50]);

var color = d3.scale.linear()
					.range(['white','darkred']);
					
var xAxis = d3.svg.axis()
    .scale(x)
    .orient("bottom");

var yAxis = d3.svg.axis()
    .scale(y)
    .orient("left");
		
var svg = d3.select("body").append("svg")
    .attr("width", width + margin.left + margin.right)
    .attr("height", height + margin.top + margin.bottom)
	.append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
	
	data.get(function(error, rows) { 

	    x.domain(d3.extent(rows, function(d) { return d.Answers; })).nice();
	    y.domain(d3.extent(rows, function(d) { return d.Questions; })).nice();
		size.domain(d3.extent(rows, function(d) { return d.Reputation; })).nice();
		color.domain(d3.extent(rows, function(d) { return d.Reputation; })).nice();
		
	    svg.append("g")
			.attr("class", "x axis")
			.attr("transform", "translate(0," + height + ")")
			.call(xAxis)
			.append("text")
			.attr("class", "label")
			.attr("x", width)
			.attr("y", -6)
			.style("text-anchor", "end")
			.text("Answers");
		
		svg.append("g")
			.attr("class", "y axis")
			.call(yAxis)
			.append("text")
			.attr("class", "label")
			.attr("transform", "rotate(-90)")
			.attr("y", 2)
			.attr("dy", ".71em")
			.style("text-anchor", "end")
			.text("Questions");
			

		svg.selectAll(".dot")
			.data(rows)
			.enter().append("circle")
			.attr("class", "dot")
			.attr("r", function(d) {return size(d.Reputation); })
			.attr("cx", function(d) { return x(d.Answers); })
			.attr("cy", function(d) { return y(d.Questions); })
			.style("fill", function(d) { return color(d.Reputation); });

	
	});<commit_msg>attempt to counteract points overlapping the axis, by introducing padding into the input domain and then removing the -ve axis tick<commit_after>var data = d3.csv("../data/QueryResults.csv")
	.row(function(d) { return {UserId: +d.UserId, Questions: +d.Questions, Answers: +d.Answers, Reputation: +d.Reputation}; }); //+ converts the string to a number and is faster than parsing

	
	
var margin = {top: 20, right: 40, bottom: 30, left: 60},
    width = 960 - margin.left - margin.right,
    height = 600 - margin.top - margin.bottom,
	pointMaxSize = 45;

var x = d3.scale.linear();

var y = d3.scale.linear();

var size = d3.scale.linear()
	.range([1, pointMaxSize]);

var color = d3.scale.linear()
					.range(['white','darkred']);
					
var xAxis = d3.svg.axis()
    .scale(x)
    .orient("bottom");

var yAxis = d3.svg.axis()
    .scale(y)
    .orient("left");
		
var svg = d3.select("body").append("svg")
    .attr("width", width + margin.left + margin.right)
    .attr("height", height + margin.top + margin.bottom)
	.append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
	
	data.get(function(error, rows) { 

	    x.domain(d3.extent(rows, function(d) { return d.Answers; })).nice();
	    y.domain(d3.extent(rows, function(d) { return d.Questions; })).nice();
		
		//make it so the points don't overlap the axis
		// extend the domain using invert (with the default range [0, 1]) to ensure the points don't overlap the axis
		x.domain([-.1, 1].map(x.invert))
		    			   .range([0, width]); //use the real range
			
		y.domain([-.1, 1].map(y.invert))
			        	.range([height, 0]);
		
		size.domain(d3.extent(rows, function(d) { return d.Reputation; })).nice();
		color.domain(d3.extent(rows, function(d) { return d.Reputation; })).nice();
		
	    svg.append("g")
			.attr("class", "x axis")
			.attr("transform", "translate(0," + height + ")")
			.call(xAxis)
			.append("text")
			.attr("class", "label")
			.attr("x", width)
			.attr("y", -6)
			.style("text-anchor", "end")
			.text("Answers");
		
		svg.append("g")
			.attr("class", "y axis")
			.call(yAxis)
			.append("text")
			.attr("class", "label")
			.attr("transform", "rotate(-90)")
			.attr("y", 2)
			.attr("dy", ".71em")
			.style("text-anchor", "end")
			.text("Questions");
			

		svg.selectAll(".dot")
			.data(rows)
			.enter().append("circle")
			.attr("class", "dot")
			.attr("r", function(d) {return size(d.Reputation); })
			.attr("cx", function(d) { return x(d.Answers); })
			.attr("cy", function(d) { return y(d.Questions); })
			.style("fill", function(d) { return color(d.Reputation); });
			
			
			//remove the -200 axis (could improve later by using the sizzle :contains() selector
			svg.selectAll("body > svg > g > g.y.axis > g:nth-child(1) > text").remove();

	
	});
{'fraction_non_alphanumeric': 0.21660649819494585, 'fraction_numerical': 0.017248295226634576, 'mean_word_length': 3.2587532023911185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6766502', 'n_tokens_mistral': 2067, 'n_tokens_neox': 1784, 'n_words': 407}