Author |
Topic |
|
stanleyfapps
USA
5 Posts |
Posted - 07/31/2014 : 2:08:04 PM
|
Origin Ver. and Service Release (Origin 9): Operating System: Windows 7 (via Parallels on Mac)
Hi, thanks for help in advance. I checked the forum thoroughly before posting, so I hope this isn't redundant.
I think what I'm trying to do should be simple, but I can't figure it out. I have a set of data that I want to split up by some index. I managed to do this by first making an index column and then using that index column to create another column that selects between two other columns, depending on the value of index column. The index column has integer values, say between 1-3. Then I created a simple scatter plot whose color is indexed to the index column, so that i have what appears to be 3 plots, each of a different color, each containing a few hundred data points. Now, I want a legend that represents reflects these three indices. However, I can't figure out how to do this. I've tried creating an enhanced legend, but this creates an element in the legend for each data point. I only want an element in the legend for each unique index, i.e. 3 unique elements in the legend. One representative of each "set" of data.
Any help is much appreciated! |
|
lkb0221
China
497 Posts |
Posted - 07/31/2014 : 2:20:59 PM
|
Hi,
Please right click the header of the index column and select "Set as Categorical". And then create a enhanced legend again.
Zheng OriginLab |
|
|
stanleyfapps
USA
5 Posts |
Posted - 07/31/2014 : 3:27:59 PM
|
Thanks, Zheng.
I could have sworn that I tried this when I was playing around with the index column as a categorical column.
As a follow up, what I really want to do is assign legend elements like "Charge 1", "Discharge 1", "Charge 2", etc. I need to use a few conditional statements to accomplish this, but I can't seem to get a text output. For example, if I want every odd index to represent a "Charge" cycle and every even index to represent a "Discharge" cycle, and I want these numbered, I've tried:
(mod(Col("Index"),2)==1) ? "Charge":((mod(Col("Index"),2)==0) ? "Discharge":"")
This is an approximation of what I want, without the index number after "Charge" or "Discharge", but I can't even make this work. |
|
|
lkb0221
China
497 Posts |
Posted - 07/31/2014 : 4:34:26 PM
|
Hi,
Conditional operator does not support string assignment. You might need to use if condition in before formula script.
Zheng OriginLab |
|
|
stanleyfapps
USA
5 Posts |
Posted - 07/31/2014 : 4:46:02 PM
|
Hi Zheng,
Thanks again for the response. Could you elaborate on how to do this? |
|
|
lkb0221
China
497 Posts |
Posted - 08/01/2014 : 09:55:49 AM
|
|
|
|
stanleyfapps
USA
5 Posts |
Posted - 08/01/2014 : 12:16:49 PM
|
Wow, this is very helpful! Thank you! |
|
|
stanleyfapps
USA
5 Posts |
Posted - 08/01/2014 : 2:28:32 PM
|
One last follow up.
I have some cells that I want blank. I do this by assigning the value (in your example) of r2[ii] = "";
However, rather than this resulting in a truly blank cell, I get a cell containing a double dash, such as "--" The problem with this is that, when set as a categorical column, the legend recognizes this symbol as a distinct category. In one tutorial I came across, it suggested...
"select Show Missing as Blank to show missing values as blank instead of displaying the "--" characters"
But this didn't work. Any help? |
|
|
lkb0221
China
497 Posts |
Posted - 08/04/2014 : 10:08:53 AM
|
Hi,
Yes, in 9.1 it will put all category values into the legend, even missing value, and we will improve this in our next released version.
So currently, you might have to delete the redundant line in legend manually.
Zheng OriginLab |
|
|
|
Topic |
|
|
|