The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Bug? Using user-defined colors in the legend
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

johannes.kastl

Germany
71 Posts

Posted - 08/30/2012 :  07:19:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello everyone,

one can define up to 16 colors and store them in the user-defined colors. You can use them as fill colors, symbol colors, etc. or when used in an index column to set different bars in a bar diagramm do different colors. The index is 25 to 40, 1 to 24 are the Origin colors.

Also, in the legend you can manually plot symbols, e.g. if your symbol size is very small in the diagramm, so you want the displayed bigger in the legend.

Syntax is:
\L(O SymEdgeColor,Sym,Fill,Size,ColorLn,LineStyle,Gap,LnWidth,SymFillColor, EdgeThickness)


Works like a charm, except I am not able to use the user-defined colors (25 to 40) in that syntax, I always end up with black. I tested with SymEdgeColor, ColorLn and SymFillColor. None worked.

Seems like a bug to me, if this is not intended. But what should it be for?

Origin Ver. and Service Release (Select Help-->About Origin): 8.6.0G SR3, Operating System: WinXP

Thanks in advance,
Johannes

easwar

USA
1964 Posts

Posted - 08/30/2012 :  10:44:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Johannes,

Thank you for catching and reporting this issue. Yes, color index numbers above 24 are not working with this syntax, we will look into this.

For now if you just want to increase symbol size, you could use the simpler expression of:
\L(DataListPosition,s:p##)
such as:
\l(1,s:p100) %(1)
and this works fine, as it only specifies size, and not the color index.

Easwar
OriginLab
Go to Top of Page

Sam Fang

291 Posts

Posted - 08/31/2012 :  02:07:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can use rgb value for the custom color in the syntax.

e.g. for yellow color, you can type the script in the Script Window:
color(255,255,0)=


It will output:
color(255,255,0)=16842751

So you can use 16842751 to represent the color in the legend's syntax.

We have reported your suggestion to our bug tracking database. We will support custom color index in the script in the future.

Thanks.

Sam
OriginLab Technical Services
Go to Top of Page

johannes.kastl

Germany
71 Posts

Posted - 08/31/2012 :  02:44:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

thanks for confirming that it is not working, and thanks for looking into it.

@easwar:
Thank for the tip, I already used this. Its just that sometimes I need to show symbols different from the plots, e.g. when single points or bars have been modified.

@Sam:
I tried your example, which worked fine. Then I tried the numbers I have in the CustomColors.ini, in which the user-defined colors are stored by Origin (this file has been created with Origin 8.1, but worked in 8.6 without problems, at least up until now).
And these numbers did not work, all I got was black.

I then checked the actual RGB values, and put them into the color() function. And each result was different from the value in CustomColors.ini

Example: One of the custom colors is RGB(237,255,181), which is a light green. The value in CustomColors is 11927533, color() says its 28704749.

I found:
http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Color_%28function%29
There, color(1,2,3) results in 16777216, my Origin puts out 16974337.

http://www.originlab.com/www/helponline/origin/en/UserGuide/Using_a_Dataset_to_Control_Plot_Color.html#Direct_RGB
This page says the values are calculated with
R + (256 * G) + (65536 * B)
So Red (255,0,0) should yield 255. color() says otherwise (16777471).

Am I missing something here? I thought I could use the values directly, but it seems I have to recalculate each custom color with color().

Regards,
Johannes
Go to Top of Page

johannes.kastl

Germany
71 Posts

Posted - 08/31/2012 :  03:17:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Seems like color() takes the value calculated from the RGB values and adds 16777216. So black (0,0,0 or 0) gets 16777216, and white is no longer 16777215 but 33554431. Everything over 16777215 therefore is a color()-value.

Would be nice if you could use the 'normal' values calculated from RGB in the legend, not only the ones from color().

Regards,
Johannes
Go to Top of Page

Sam Fang

291 Posts

Posted - 09/03/2012 :  04:20:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Johannes,

you are right. The result in the page is wrong.
http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Color_%28function%29

I have corrected it. Thanks for your reporting.

We use the shift of 16777216 for RGB value because we use 1-24 for 24 builit-in colors in the color list. If we use 2 for RGB(2,0,0), then 2 can't represent the second color in the color list: red.

Sam
OriginLab Technical Services
Go to Top of Page

johannes.kastl

Germany
71 Posts

Posted - 09/04/2012 :  04:29:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sam,

unfortunately its inconsistent, if you use 'real' RGB values for user-defined colors or RGB columns, see
http://www.originlab.com/www/helponline/origin/en/UserGuide/Using_a_Dataset_to_Control_Plot_Color.html#Direct_RGB


I don't know if this confuses people, I think not too many need these features. But may a short paragraph for clarification (difference between RGB and color() function) would be nice on these pages.

Jm2c,
Johannes
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000