Author |
Topic  |
|
rockyraccoon
8 Posts |
Posted - 08/14/2009 : 05:55:58 AM
|
Hi, I have a dataset made of labelled X,Y points. I can scatter X,Y and set the label column as 'label', which results in a scatterplot where each point is labelled. However this results in a *very* crowded plot. Since there are hundreds of points, but only a handful of labels, I would like to 'assign' a color to each label, and draw a color-coded scatterplot. Could anyone suggest how to do this? Many thanks
Origin Ver. and Service Release: 8.0.63.988 SR6 Operating System: WinXP |
|
easwar
USA
1965 Posts |
Posted - 08/14/2009 : 10:50:59 AM
|
Hi,
Here are two possibilities:
1> Open plot details dialog from the scatter plot, then under Symbol tab, click on Symbol Color drop-down and pick Indexing and assign the Label column as the index. Origin will internally assign colors based on the text
The above would be limited in terms of controlling color, so you could do this 2nd method instead:
2> Add a 4th column, right click on this column, and bring up "Set Column Values" dialog, then in the "Before Formula Script" panel, enter the following code, set Recalculate to auto and press OK: range r3=3, r4=4; loop(ii,1,r3.GetSize()) { %a=r3[ii]$; r4[ii]=asc(%a); }
This will fill 4th col with ascii value of the upper case of the 1st character in each label. Then in Plot Details select Color Mapping from the Symbol Color drop-down and assign this 4th column. You will then have better control in assigning a color map to the values.
So as long as the first character of your text is unique this will work, if first character not unique you could use other string functions to extract more characters and do some math to come up with reasonable numbers that better represent your text.
then, in order to represent what color goes with what label, you can build a legend by right clicking on the legend and selecting Properties and in the dialog enter legend text such as: \l(1,1) yourlabel1 \l(1,2) yourlabel2 \l(1,4) yourlabel3 So basically you will need to make as many entries as there are unique labels and find points that correspond to each unique label, and put in your label text in the legend literally
Can you send us your data? We could then think of what other way this could be graphed. You can send to tech support and refer to this post.
Easwar OriginLab |
 |
|
rockyraccoon
8 Posts |
Posted - 08/19/2009 : 11:43:55 AM
|
Thanks! solution (1) was all I needed.
quote: Originally posted by easwar
Hi,
Here are two possibilities:
1> Open plot details dialog from the scatter plot, then under Symbol tab, click on Symbol Color drop-down and pick Indexing and assign the Label column as the index. Origin will internally assign colors based on the text
The above would be limited in terms of controlling color, so you could do this 2nd method instead:
2> Add a 4th column, right click on this column, and bring up "Set Column Values" dialog, then in the "Before Formula Script" panel, enter the following code, set Recalculate to auto and press OK: range r3=3, r4=4; loop(ii,1,r3.GetSize()) { %a=r3[ii]$; r4[ii]=asc(%a); }
This will fill 4th col with ascii value of the upper case of the 1st character in each label. Then in Plot Details select Color Mapping from the Symbol Color drop-down and assign this 4th column. You will then have better control in assigning a color map to the values.
So as long as the first character of your text is unique this will work, if first character not unique you could use other string functions to extract more characters and do some math to come up with reasonable numbers that better represent your text.
then, in order to represent what color goes with what label, you can build a legend by right clicking on the legend and selecting Properties and in the dialog enter legend text such as: \l(1,1) yourlabel1 \l(1,2) yourlabel2 \l(1,4) yourlabel3 So basically you will need to make as many entries as there are unique labels and find points that correspond to each unique label, and put in your label text in the legend literally
Can you send us your data? We could then think of what other way this could be graphed. You can send to tech support and refer to this post.
Easwar OriginLab
|
 |
|
|
Topic  |
|
|
|