I'm using Highcharts to create scatter plots.
The problem is that the scatter plots seem to default to having background (i.e. not part of the data, just for scale) lines either parallel to the x-axis, or to the y-axis, but not both at the same time.
Here's an example that I used to get started making scatter plots. Note the lines parallel to the x-axis.
How do I get a scatter plot with background lines in both axes?
=> Horizontal and vertical lines in the plot area of a chart are called Gridlines.
The method axhline and axvline are used to draw lines at the axes coordinate. In this coordinate system, coordinate for the bottom left point is (0,0), while the coordinate for the top right point is (1,1), regardless of the data range of your plot. Both the parameter xmin and xmax are in the range [0,1].
The default values for the gridLineWidth
is 1
for yAxis and 0
for xAxis, resulting in only the horizontal lines showing. What you need to do is to set the width to 1
for both x and y.
yAxis: {
gridLineWidth: 1 // The default value, no need to change it
},
xAxis: {
gridLineWidth: 1 // New value
},
Example on jsfiddle:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With