+ Reply to Thread
Results 1 to 7 of 7

Color points in a scatter plot based on a number

  1. #1
    Registered User
    Join Date
    07-07-2016
    Location
    Kuwait
    MS-Off Ver
    2016
    Posts
    28

    Color points in a scatter plot based on a number

    I have a simple scatter plot of X,Y points (data in columns A and B). I would like to color each point based on the value in column C.

    I would like the colors to change smoothly and have a good range.

    If anyone has an example workbook of something similar to this I would be grateful.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Color points in a scatter plot based on a number

    The standard approach to conditional formatting in charts is to add each color/condition as a separate data series, where your conditions form the basis of formulas that decide which data series each point belongs in. http://peltiertech.com/conditional-f...-excel-charts/
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    07-07-2016
    Location
    Kuwait
    MS-Off Ver
    2016
    Posts
    28

    Re: Color points in a scatter plot based on a number

    Quote Originally Posted by MrShorty View Post
    The standard approach to conditional formatting in charts is to add each color/condition as a separate data series, where your conditions form the basis of formulas that decide which data series each point belongs in. http://peltiertech.com/conditional-f...-excel-charts/
    Thanks for the link. It's not a bad approach and would work ok with my data. I would prefer though a VBA solution. I found some code (http://stackoverflow.com/questions/3...16834#41716834) that should do what I want (it uses a finely varying color map pasted in to a worksheet) but I can't get it to run without error. If anyone could get it working on a simple example workbook I would be very grateful.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Color points in a scatter plot based on a number

    Have you tried to do it step by step as explained in linked page (including color lookup table preparation)?
    You also not refer what particular error you received.

    Anyway, see how it works in attached example
    Attached Files Attached Files
    Best Regards,

    Kaper

  5. #5
    Registered User
    Join Date
    07-07-2016
    Location
    Kuwait
    MS-Off Ver
    2016
    Posts
    28

    Re: Color points in a scatter plot based on a number

    Quote Originally Posted by Kaper View Post
    Have you tried to do it step by step as explained in linked page (including color lookup table preparation)?
    You also not refer what particular error you received.

    Anyway, see how it works in attached example
    Hi Kaper,

    Thanks very much for getting this working. My attempt was somewhat similar to yours (I had copied the colour map over and that was working) but the code that I pasted in wasn't compiling. I will compare later with yours to work out where I was going wrong.

    Just one quick question if I may. I added some random numbers in column K (values in range 70 to 80) and then changed the 'h' in the code to 'k' and the points all plot out as blue. I was hoping that the code would find the maximum and minimum and then distribute the available colours (255 colours) over the new values (i.e. 255 colours over a range of 10). Is there another line that needs changing?

    Thanks,

  6. #6
    Registered User
    Join Date
    07-07-2016
    Location
    Kuwait
    MS-Off Ver
    2016
    Posts
    28

    Re: Color points in a scatter plot based on a number

    Ok, I managed to figure out how to change the limits and it now spreads the colours over the range of values.
    Thanks,

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Color points in a scatter plot based on a number

    Glad to hear that, and thanks for marking thread as Solved and for reputation added.

+ 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. Identifying Points in a Scatter Plot
    By jbianco51 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 08-20-2014, 04:42 PM
  2. Show interval points on scatter plot
    By dpkennedy24 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 06-05-2014, 09:24 AM
  3. Representing same data points in a scatter plot
    By Chandelia in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-03-2009, 05:54 AM
  4. Only plot scatter points that have both an X and a Y value (2007)
    By JayUSA in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-15-2009, 04:23 AM
  5. Excel 2007 : Labelling Data Points on a Scatter Plot
    By SDruley in forum Excel General
    Replies: 3
    Last Post: 06-01-2009, 09:56 AM
  6. [SOLVED] Connecting Points In An XY-Scatter Plot Graph
    By Adam WK in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-09-2006, 02:10 PM
  7. [SOLVED] Scatter plot points x and y coordinates
    By Milo in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-28-2005, 07:25 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