g = Gruff::Scatter.new(1200) По вертикальной оси графика необходимо отобразить не от 0 и…
Private research annotation
Sign in to add a private research label or note.
- User
g = Gruff::Scatter.new(1200) По вертикальной оси графика необходимо отобразить не от 0 и выше, а в пределах, установленных значений данных в массиве, например, [60.776870, 60.770000]
Assistant
By default, Gruff will automatically scale the y-axis to fit the range of values in your data. However, you can customize the y-axis range by setting the
y_axis_rangeoption.In your case, you can do something like this:
codeg = Gruff::Scatter.new(1200) g.data("Data", [60.776870, 60.770000]) g.y_axis_range = [60.76, 60.78] # set the y-axis range to [60.76, 60.78] g.write('scatter.png')This will set the y-axis range to
[60.76, 60.78], which is a range that encompasses the values in your data array.Note that you can also set the
y_axis_range-minandy_axis_range-maxoptions separately, like this:codeg.y_axis_range_min = 60.76 g.y_axis_range_max = 60.78This will achieve the same effect as setting
y_axis_rangedirectly.