×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro to labe an XY scatter plot

Macro to labe an XY scatter plot

Macro to labe an XY scatter plot

(OP)
As far as I know there is no way to label each point in a XY scatter plot. Has anyone come across a macro that can do this? or any other means?

Thanks,
Mike

RE: Macro to labe an XY scatter plot

what kind of label are we talking?
x value
y value?
x, y pair?
other text?

=====================================
Eng-tips forums: The best place on the web for engineering discussions.

RE: Macro to labe an XY scatter plot

(OP)
I mean a data label for each point on the XY scatter plot extracted from a third column containing the labels.

RE: Macro to labe an XY scatter plot

(OP)
This label would be a text

RE: Macro to labe an XY scatter plot

(OP)
Never mind.......This macro I found works for me,

Sub LabelPoints()
'
'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select

Dim myXValues As Range
Dim myYValues As Range
Dim myNameValues As Range

Set myXValues = Application.InputBox(prompt:="Range of X Values?", Type:=8)
Set myYValues = Application.InputBox(prompt:="Range of Y Values?", Type:=8)
Set myNameValues = Application.InputBox(prompt:="Range of Labels?", Type:=8)

For i = 1 To 20
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).XValues = myXValues(i)
ActiveChart.SeriesCollection(i).Values = myYValues(i)
ActiveChart.SeriesCollection(i).Name = myNameValues(i)

ActiveChart.SeriesCollection(i).Select
With Selection.Border
.Weight = xlHairline
.LineStyle = xlNone
End With
With Selection
.MarkerBackgroundColorIndex = 25
.MarkerForegroundColorIndex = 25
.MarkerStyle = xlDiamond
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
Next

End Sub


Thanks,
Mike

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources