Picking the color with highest contrast

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Picking the color with highest contrast

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:16 pm

by pillick >> Tue, 19 Nov 2002 23:11:26 GMT

I've just come across a problem that I figure someone else has probably solved allready.

Im graphing information and want to plot several series on the same graph. Each series needs to be plotted in a color that contrasts highly with any of the other series' colors. Any ideas how I would have the program choose the best color for each new series automatically?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Picking the color with highest contrast

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:16 pm

by allistar >> Wed, 20 Nov 2002 0:51:45 GMT
I've just come across a problem that I figure someone else has probably solved allready.

Im graphing information and want to plot several series on the same graph. Each series needs to be plotted in a color that contrasts highly with any of the other series' colors. Any ideas how I would have the program choose the best color for each new series automatically?

It depends on how many series you expect to be displayed on any one graph. If the maximum number is known at design time, I would hard code the first, say, 20 colours to be ones that you choose.

I don't have any suggestions on how to dynamically pick the colours for graphs that have very large number of series.

An alternative is not to rely on colour alone to distinguish different series. You could use different line styles as well (like dot-dash and dot-dot-dash etc). Then you could just stick to your 20 odd predefined colours.

Regards,
Allistar.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Picking the color with highest contrast

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:16 pm

by hml >> Wed, 20 Nov 2002 9:40:38 GMT

Try http://www.lighthouse.org/color_contrast.htm. This should help with the colour selection but agree that using line styles is a good idea.

Torrie

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Picking the color with highest contrast

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:16 pm

by johnmunro >> Thu, 21 Nov 2002 14:14:27 GMT

We had this problem and tried to solve it by working out the hue for the background colour and setting the foreground colour to either black or white depending on whether the hue was higher or lower than 128. It works most of the time but not always, although I think something similar could be very effective.

John Munro

---
Synergist Limited - Home of FileVision
The Bioscience Innovation Centre
Cowley Road, Cambridge, UK
CB4 0DS

Telephone: +44 (0) 1223 478200
Fax: +44 (0) 1223 477969
Email: john.munro@filevision.com
Web: http://www.filevision.com

The contents of this communication are confidential and are only intended to be read by the addressee. We apologize if you receive this communication in error and ask that you contact Synergist Limited immediately to arrange for its return. The use of any information contained in this communication by an unauthorized person is strictly prohibited. Synergist Limited cannot accept responsibility for the accuracy or completeness of this communication as it is being transmitted over a public network. If you suspect this message may have been intercepted or amended, please inform Synergist Limited.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Picking the color with highest contrast

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:16 pm

by cnwkpd1 >> Tue, 26 Nov 2002 1:30:20 GMT

If you want to use purely colours, then try the methods on IntegerArray and Integer attached. These will populate the array with a variable number of unique colours, starting with red, blue and green (and B & W), and then progressively use the intermediate colours until the number of unique ones is found.

Differences in the colours get more subtle the more colours you need, but it seems to give enough contrasting colours for our need.

Kevin Douglas
kdouglas@jadeworld.com
Attachments
2621_1.scm
(3.6 KiB) Downloaded 110 times


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 17 guests