Error bar frequency

WithTheRanks

New Member
Joined
Oct 9, 2014
Messages
1
Hi guys.
I'm plotting a large data set as an x-y scatter, with a lot of close together points. When I add error bars for every data point they are so closely packed as to make a huge black blur along the graph. Is there a way to plot all the data points, but add error bars for only every nth point (say tenth, fiftieth, etc)? I'm also using a column of custom errors for the bars.
Thanks.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hello and welcome to the Board

The code below produces the following result:

ebars2.JPG


Code:
Sub SomeBars()
Dim posY As Range, negY As Range, s As Series, i%
Const Spacing = 4 ' adjust the frequency here
Range("x58:y157").Value = Range("ab58:ac157").Value ' get all custom error values
Set s = ActiveSheet.ChartObjects("Chart5").Chart.SeriesCollection(1)
Set posY = Range("y58:y157")
Set negY = Range("x58:x157")
s.ErrorBar xlY, xlErrorBarIncludeBoth, xlErrorBarTypeCustom, "='" & _
posY.Parent.Name & "'!" & posY.Address(, , xlR1C1), "='" & negY.Parent.Name & _
"'!" & negY.Address(, , xlR1C1)
MsgBox "All error bars are there..."
' eliminate unwanted bars
For i = negY.Cells(1, 1).Row To negY.Rows.Count + negY.Cells(1, 1).Row
   If i Mod Spacing <> 0 Then Cells(i, 24).Resize(, 2).Value = 0
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,736
Members
448,988
Latest member
BB_Unlv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top