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
 Direct RGB. How to set the colours?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jordai

Australia
8 Posts

Posted - 06/02/2013 :  8:47:36 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.6
Operating System: Windows
Hi,

In a 2D scatter graph I would like to use personalized colours using RGB codes instead of the proposed by Origin. However I don't 100% understand the procedure. Do I have to create a column with the colour code?
All the iformation I've found about that topic is this:
--------------------
An RGB composite value is computed from triplet components of Red, Green, and Blue. The R, G, and B component values range from 0 to 255.

RGB composite = (2560 * R) + (2561 * G) + (2562 * B)

... which is equivalent to...

RGB composite = R + (256 * G) + (65536 * B)

To use this option:

Double-click on the data plot that you wish to modify. This opens the Plot Details dialog box.
Select the Symbol tab, Pattern tab, etc.
Click the Symbol Color button and select Direct RGB: Dataset, where Dataset contains the RGB composite values
-------------------------

1) if RGB are coded from 0 to 255, what is the 256 and the respective exponential?
2) what is the final number I have to enter in the column?

Thanks in advance for the answer.
Cheers,

snowli

USA
1379 Posts

Posted - 06/03/2013 :  12:25:54 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Your understanding is correct. You need to create a column with RGB calculated composite values. We use
RGB composite = R + (256 * G) + (65536 * B)
to computer the RGB composite value.

We have a Labtalk function color(R, G, B) to calculate it as well.

Then as you said specify Symbol color to be Direct RGB: and specify which column value to use.


http://www.originlab.com/www/helponline/origin/en/UserGuide/Using_a_Dataset_to_Control_Plot_Color.html#Direct_RGB

Thanks, Snow Li
OriginLab Corp.

Edited by - snowli on 06/03/2013 2:40:00 PM
Go to Top of Page

jordai

Australia
8 Posts

Posted - 06/03/2013 :  9:28:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Snow Li, it did work.
However, my symbols have error bars, and it seems the RGB is not an option for the colour bars. Is that true or there is a way to have the same RGB colour for the error bar like the symbols?

Regards,
Go to Top of Page

snowli

USA
1379 Posts

Posted - 06/04/2013 :  12:12:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jordai,

It should work.

If you double click the error bar to open Plot Details dialog. The color should be auto which means it will follow the symbol color.

I tried in 8.6 SR3 and it works.
E.g.

Thanks, Snow Li
OriginLab Corp.
Go to Top of Page

jordai

Australia
8 Posts

Posted - 06/04/2013 :  6:55:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is the option "auto", but it sets the colour to black, independently the colour of the symbol. I'm using 8.6.0 (64-bit) b70 (Academic).
What's the SR3? this version might be slightly different than mine maybe?

Regards,
Go to Top of Page

snowli

USA
1379 Posts

Posted - 06/05/2013 :  10:12:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You are using Origin 8.6 SR0. We already recommend people to patch to latest SR version since we release multiple patches to fix bugs, etc.

So could you choose Help: Check for Updates to patch to latest 8.6 SR3.

You will need to run Help: Check for Updates multiple times to patch from sr0 to sr1 and then to sr2 and then to sr3.


Thanks, Snow Li
OriginLab Corp.
Go to Top of Page

Pls_help_me

8 Posts

Posted - 07/08/2014 :  10:23:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello an thank you for your replies and support,

i have finally made it to solve my problem. My final code looks like this:

newbook mat:=1; //new matrix
impimage; //import of images
%A=%H; //saveing the name of the matrix as %A



//loop over all objects in the matrix
for(int i = 1; i <= 14; i++) //must be adapted to needs
{
window -a %A; //activate matrix
wks.active=i; //activate object in matrix
matrix -ii 0; //switch to data mode
m2w method:=xyz; //converting matrix to worksheet
discfreqs -r 1 irng:=[%H]1!3; //calculating counts

// three new columns
wks.addcol();
wks.addcol();
wks.addcol();

// set names as R/G/B
col(3)[L]$ = "R";
col(4)[L]$ = "G";
col(5)[L]$ = "B";

// converting worksheet values to original RGB values
csetvalue col:=col(5) formula:="int(col(1)/(256*256))" recalculate:=1;
csetvalue col:=col(4) formula:="int((col(1) - 256 * 256 * col(5))/256)" recalculate:=1;
csetvalue col:=col(3) formula:="col(1)-256*col(4)-256*256*col(5)" recalculate:=1;

//new columns for deriving percentage with black
//calculating how many pixels in total
wks.addcol();
col(6)[L]$ = "% mit schwarz";
csetvalue col:=col(6) formula:="col(2)*100/(Max(sum(col(2))))" recalculate:=1;

//percentage without black
wks.addcol();
range r1 = Col(2)[1:1]; //define cell with the counts of black
col(7)[L]$ = "% ohne schwarz"; //set name
csetvalue col:=col(7) formula:="col(2)*100/(Max(sum(col(2)))-r1)" recalculate:=1; //calculate %



}


Definitley not an elegant solution but it works for my purpose. Thank you,

Best regards
Raphael





Just my signature...
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