+ Reply to Thread
Results 1 to 5 of 5

XY scatter plot colored by Z

  1. #1
    Registered User
    Join Date
    08-06-2013
    Location
    the boonies
    MS-Off Ver
    Excel 2007
    Posts
    46

    XY scatter plot colored by Z

    Hi,

    I'm looking for VBA code to color an XY Scatter chart by Z (i.e. another property value in an adjacent column).
    Ideally this would also display a colorbar.

    Thanks!
    geophysicist

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: XY scatter plot colored by Z

    something like this should get you started.

    Please Login or Register  to view this content.
    The legend in M2:M11 is a simple 1-10 scale using conditional formatting.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    08-06-2013
    Location
    the boonies
    MS-Off Ver
    Excel 2007
    Posts
    46

    Cool Re: XY scatter plot colored by Z

    Andy,

    Thanks for tackling my problem. The code you provided was indeed a very good starting point, as I had absolutely no idea where to begin. The guts of it gave me enough to go play with, though. Also, I like the clever use of conditional formatting to make the colorbar. Great, simple idea.

    In the course of using that first-pass code, I discovered a few functionality pitfalls. The most critical one was that the colorbar values were not referenced, only the element number of the colorbar cells. The other issue was that Z-values < 1 and Z-values > the number of cells in the colorbar were all painted white.

    I was able to resolve these issues on my own and present my final code here, along with a new copy of the spreadsheet showing its development.

    Please Login or Register  to view this content.
    This is such a basic functionality gap (coloring XY data by Z data) that I can't believe Excel hasn't done this themselves.
    I was also surprised not to be able to find this kind of VBA code very easily on my online search.
    So, I hope someone actually refers to this post and gets some value out of it.
    If so, please * me.


    Cheers,
    g
    Attached Files Attached Files
    Last edited by geophysicist; 08-17-2013 at 02:28 AM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: XY scatter plot colored by Z

    Although the colouration is not built-in you can do it without code by using multiple series and formula.

    Also the 56 colour limit was for xl2003 and older.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-07-2013
    Location
    DC
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: XY scatter plot colored by Z

    This is brilliant! Thanks so much for posting the solution.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Converting Scatter plot to Line plot and back
    By SPDavern in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-26-2015, 10:49 AM
  2. Excel 2010 - X Y scatter plot will not plot empty cells as gap
    By bjeffers0306 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-12-2013, 12:56 AM
  3. Replies: 2
    Last Post: 07-26-2012, 09:27 AM
  4. [SOLVED] Can I copy x-y scatter plot data direct from one plot to another?
    By Chris in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-03-2005, 09:05 AM
  5. Converting XY Scatter plot to Line Plot and back
    By SPDavern in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-09-2005, 10:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1