T O P I C R E V I E W |
injector |
Posted - 07/28/2005 : 4:10:00 PM Origin Version (Select Help-->About Origin): Operating System:v7.5776
I have two columns with 1000 data for each. How can plot a 2D plot with the 1st (1-500) set of points in red while the remain (501-1000) in blue? Right now, I can only plot them in one color. Thanks. |
8 L A T E S T R E P L I E S (Newest First) |
Leelou1303 |
Posted - 08/11/2005 : 02:33:21 AM It works!!!
Thanks a lot for your help!! |
Mike |
Posted - 08/10/2005 : 11:05:50 AM Hi Leelou1303:
I'm not sure that I have the entire picture, so you'll just have to try this to see if it does what you want it to:
1. Plot your X Y data as a scatter plot. 2. Add a fourth column to the worksheet. 3. Select new column, right-click and choose Set Column Values. 4. Enter the following and click OK (assumes that "E" is in col C):
nint(col(C))
5. Click on the XY scatter plot, choose Format:Plot and set Symbol Color to Indexing > Col(D).
The LabTalk nint( ) function will fill column D with rounded "E" values (which, if I understand correctly, should provide a basis for grouping your data and customizing your plot symbols).
Mike OriginLab |
Leelou1303 |
Posted - 08/10/2005 : 07:43:14 AM I'm afraid my dataset has about 200000 points!
I will try to explain, how I want to break up my dataset: I have 3 columns: the x-value, the y-value and one other value (let's call it value E), that decides where my group of points starts and ends.
For example: E is about 0 for the first 24000 points. (I guess the problem is, that E is not exactly 0, but scatters around 0. It is a measured value).These points should be in my first group. Then E jumps to a value around 1 (but scatters again). The x- and y-values for all the E-values about 1 would be my second group of points. Next E returns to 0 for about 6000 points. These points should be again in my FIRST group. Then E is going to be 2 for another 24000 points. These will form my third group. E jumps back to 0...... and so on.
Is it possible to do that? |
Mike |
Posted - 08/08/2005 : 09:25:45 AM Well, you have two problems:
First, if you want to do what injector did, you have to create an additional column of values that can be used to control the plot symbol color of the data in the Y column. As you found out, the Set Column Values expression that you tried to adapt to your situation isn't going to work; it was really specific to injector's situation (for info on the ternary operator, see LabTalk Help topic = Conditional Operators).
Since it doesn't look like your group sizes are uniform (60, 30, 30...), you'll need a more complex expression to generate your color control values, if you want to do this programmatically. Depending on your situation, it may not even be worth bothering with. Not knowing how you want to break up your dataset, we can't give you a precise solution.
Your second problem -- the real problem -- is to plot groups of data using different colors and there are several possible approaches. If you have a reasonably small dataset (500 pts?) you might just copy and paste to place group values in separate columns. Then -- assuming we're just talking about an X-Y data plot -- you can just highlight all Y columns and create your scatter or line + symbol plot. Grouped plots will automatically plot using separate colors. I could have suggested the same solution to injector, but since his dataset could easily be subdivided systematically, it was easier to assign a different symbol color to ranges of data in a single Y column.
So, if you want to approach this like injector did, we'll need to know how many points are in your dataset, and how it is to be broken up. Otherwise, just break the dataset up manually, put each group into a separate Y column, select all Y columns, and plot.
Mike OriginLab |
Leelou1303 |
Posted - 08/08/2005 : 05:45:51 AM Hi! I have almost the same problem, but I need to have many different colors. Like from row 20 to 80 the color blue, from 90 to 120 red, from 120 to 150 green...
I tried to fill the column with the order: 20 < i < 80 ? 2 : 4 But this didn't work.
Can you help me? |
injector |
Posted - 07/29/2005 : 12:29:12 PM got you. basically a third colunm is needed to define color. many thanks |
Mike |
Posted - 07/29/2005 : 09:11:02 AM ... actually, I realized after I posted that I made this a little more complicated than it needed to be. If I had used the expression...
i < 501 ? 2 : 4
... in the Set Column Values dialog for column C, I could have set Symbol Color to Indexing:Col(C) and I would not have needed to bother with color mapping (in the standard Origin color palette (Format:Color Palette) red = 2, blue = 4).
Mike OriginLab |
Mike |
Posted - 07/28/2005 : 5:31:06 PM Hi injector:
Add a third column to your worksheet, right click on the column heading and choose Set Column Values. For row i=1 to 1000, enter the following expression into the dialog box (then click OK):
i < 501 ? 1 : 2
Select your second (Y) column and create a scatter plot. Double-click on the plot and open the Plot Details dialog box. Set Symbol Color to Color Mapping > Col(C) Select the Color Map tab and click on the Level column header. In the Set Levels dialog, set Minimum = 1, Maximum = 2, Number of Levels to 2. Set Fill Levels < 1 and 1 = red, and 1.5 and > 2 = blue (a little messy but it works). Click OK. To edit your legend symbols:
Right click on the legend object and select Properties In the Text Control dialog box, enter this:
\L(1) pts less than 501 \L(1.1,501) greater than or equal to 501
(see the Origin Help file topic = Text and Drawing Objects>Legends and Color Scales> Adding an Individual Data Point to the Legend).
Mike OriginLab |
|
|