Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

display vertical lines and horizontal lines on plots

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?

like image 276
Matt Fenwick Avatar asked Jan 18 '12 13:01

Matt Fenwick


People also ask

What are the horizontal and vertical lines in the plot area?

=> Horizontal and vertical lines in the plot area of a chart are called Gridlines.

How do you draw a vertical and horizontal line in Python?

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].


1 Answers

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:

enter image description here

like image 104
eolsson Avatar answered Sep 22 '22 22:09

eolsson