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
 Highlight ranges on XY graph with color
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1205 Posts

Posted - 07/27/2021 :  09:44:56 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2021b (64-bit) SR2 9.8.5.212
Windows 10 21H1 x64

Greetings!

I have a worksheet with Range ID, X start, X End columns and I want to highlight each range (row of the worksheet) on the existing XY graph.
I see two options: fill color under selected range of a curve (https://www.originlab.com/doc/Quick-Help/fill-color-under-range) and fill entire X range throughout Y axis limits.

How do I achieve this in (semi)automated manner (not manually, without using LT)?

Thank you.



---
Andrey

snowli

USA
1386 Posts

Posted - 07/27/2021 :  11:12:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can use axis reference line to do this
https://www.originlab.com/doc/Origin-Help/AxesRef-RefLines

There is Details button to customize each reference line. Fill to which position. Uncheck Auto Format, u can customize fill color, transparency, of each range, etc.

The filled color is behind plot by default so it will not block data.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/27/2021 :  1:19:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Hello,

You can use axis reference line to do this
https://www.originlab.com/doc/Origin-Help/AxesRef-RefLines

There is Details button to customize each reference line. Fill to which position. Uncheck Auto Format, u can customize fill color, transparency, of each range, etc.

The filled color is behind plot by default so it will not block data.

Thanks, Snow



OK.
Is this possible to take the data from the worksheet, along with line labels?

---
Andrey
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/27/2021 :  1:42:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Oh, I see.
https://www.originlab.com/doc/Origin-Help/AxesRef-RefLines?f=dl seems to describe a way to get text labels.
What is the proper way to display text labels for each line from the 1st column?


Now, how do I alternate fill colors while using Alternate Fill?

---
Andrey
How do I

Edited by - AKazak on 07/27/2021 1:47:13 PM
Go to Top of Page

snowli

USA
1386 Posts

Posted - 07/27/2021 :  2:45:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Where do u want to show the labels? In the middle of each filled area like the 1st image?

I am not sure if i understand your 2nd question of how to alternate colors.
There is Alternate fill checkbox on Reference Lines tab. If u check it, it will fill every other region.
There is also checkbox below Alternate Fill to include the beginning and end of axis.

To customize the color, u need to click Details.
Ctrl+ select very other row and then set Fill color to change fill color together.
Or click one row and set fill color of it. It shows where it fills to.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/27/2021 :  4:51:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Where do u want to show the labels? In the middle of each filled area like the 1st image?


Yes.
Ideally, I want to show the labels from the table and center them to the middle of the filled regions.

quote:
Originally posted by snowli

I am not sure if i understand your 2nd question of how to alternate colors.
There is Alternate fill checkbox on Reference Lines tab. If u check it, it will fill every other region.
There is also checkbox below Alternate Fill to include the beginning and end of axis.

To customize the color, u need to click Details.
Ctrl+ select very other row and then set Fill color to change fill color together.
Or click one row and set fill color of it. It shows where it fills to.

Thanks, Snow




I want to automatically assign different distinct color to each fill, so there is a color contrast in adjacent fills.

---
Andrey
Go to Top of Page

snowli

USA
1386 Posts

Posted - 07/27/2021 :  6:42:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
For now when using reference line, it seems u must do it one by one.

I added ORG-24035 to make it easy to create such filled area by each x from and to range, like your worksheet organization.

For now, u can also consider using method 1 of
https://www.originlab.com/doc/Quick-Help/Add-RecessionBars

U will need to create Y value column as well.
Then on pattern tab of Plot Details dialog, u can set fill color to be incremental. And set the color list.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/27/2021 :  11:16:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

For now when using reference line, it seems u must do it one by one.

I added ORG-24035 to make it easy to create such filled area by each x from and to range, like your worksheet organization.

For now, u can also consider using method 1 of
https://www.originlab.com/doc/Quick-Help/Add-RecessionBars

U will need to create Y value column as well.
Then on pattern tab of Plot Details dialog, u can set fill color to be incremental. And set the color list.

Thanks, Snow



Dear Snow,

Got it!
Can you share an LT example to manage Reference Lines including labels and fill colors, please?

---
Andrey
Go to Top of Page

snowli

USA
1386 Posts

Posted - 07/28/2021 :  09:44:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andrey,

See https://www.originlab.com/doc/LabTalk/ref/Layer-Axis-Refline-obj

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/28/2021 :  1:36:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Hi Andrey,

See https://www.originlab.com/doc/LabTalk/ref/Layer-Axis-Refline-obj

Thanks, Snow



Got it!

Now I want to make each fill with a unique color.

Now how do I sequentially pick colors from a defined color list in LT script?

---
Andrey
Go to Top of Page

snowli

USA
1386 Posts

Posted - 07/28/2021 :  2:31:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andrey,

Thank you for pushing this. I created ORG-24039 to provide a way to pick color from user-defined color list or palette using color() function.
That function already support many forms but not possible to pick color from a color list or palette yet.

For now, you may need to use color() function to specify RGB or HTML color for each fill color.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/28/2021 :  2:40:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Hi Andrey,

Thank you for pushing this. I created ORG-24039 to provide a way to pick color from user-defined color list or palette using color() function.
That function already support many forms but not possible to pick color from a color list or palette yet.

For now, you may need to use color() function to specify RGB or HTML color for each fill color.

Thanks, Snow



Great news!
Can you share RGB lists for all the standard Origin color lists and palettes, please? I don't want to reinvent the wheel and will use the tabular data to feed color() function.

---
Andrey
Go to Top of Page

snowli

USA
1386 Posts

Posted - 07/28/2021 :  2:47:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
In any color controls where u can see By Point or By Plot tab, u can load different color list.
Then mousing over the color in the color list will show tooltip of the HTML color and RGB values.
U can also Ctr+ double click the color list to see the whole color list and its HTML color or RGB values.

Or u can choose Tools: Color Manager.. to see them.
For built-in color list or palette, u need to first right click to duplcate it first. Then double click the color bar to see Edit color dialog with all values listed.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/28/2021 :  3:17:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

In any color controls where u can see By Point or By Plot tab, u can load different color list.
Then mousing over the color in the color list will show tooltip of the HTML color and RGB values.
U can also Ctr+ double click the color list to see the whole color list and its HTML color or RGB values.

Or u can choose Tools: Color Manager.. to see them.
For built-in color list or palette, u need to first right click to duplcate it first. Then double click the color bar to see Edit color dialog with all values listed.

Thanks, Snow



Dear Snow,

I found the suggestions useful.
However, it requires a lot of copy-paste actions.
Can you share the color values as a text file, please?

---
Andrey
Go to Top of Page

snowli

USA
1386 Posts

Posted - 10/01/2021 :  10:37:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andrey,

Several improvements are made in beta3 regarding to this post. Could you give it a try?

1. fill color under selected range of a curve

Suppose your data is organized as you said, the column with x start and end needs to be set as X. U can use any column as Y to plot it against the range X column into existing graph as line plot.
Double click the graph and pick the newly added plot. On Line tab, check enable under Fill Area under Curve
Span Vertically Pairwise is added in the dropdown list. U can choose it and then go to Pattern tab to set Fill color as Increment from and pick a start color. U can then click the pencil button next to the color list to edit the colors.
U can go to Labels tab to set the label to be from the Range ID column.

2. color() function improvements to pick color from built-in or user-defined color list or palette
E.g.
Color("candy1.oth", 1) will pick 1st color in Candy1 color list. It will first search uff folder than system folder for the file name

Color("BlueOrange2.pal", 1) will pick 1st color in BlueOrange2.pal palette file. It will first search uff folder than system folder for the file name

use Set %c -c color("candy.oth", 2) to set plot color to 2nd color of Candy color list.


Sorry that I may have missed your last question about saving color as text file. I suppose u can use our Color Editor app to load palette and color list. It will have R, G, B, HTML color columns created. U can export selected columns as ascii file.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 10/10/2021 :  12:05:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Hi Andrey,

Several improvements are made in beta3 regarding to this post. Could you give it a try?

1. fill color under selected range of a curve

Suppose your data is organized as you said, the column with x start and end needs to be set as X. U can use any column as Y to plot it against the range X column into existing graph as line plot.
Double click the graph and pick the newly added plot. On Line tab, check enable under Fill Area under Curve
Span Vertically Pairwise is added in the dropdown list. U can choose it and then go to Pattern tab to set Fill color as Increment from and pick a start color. U can then click the pencil button next to the color list to edit the colors.
U can go to Labels tab to set the label to be from the Range ID column.
Thanks, Snow


I cannot reproduce this to show color fill correctly.
Can you share a demo project or screen recording, please?


quote:
Originally posted by snowli
2. color() function improvements to pick color from built-in or user-defined color list or palette
E.g.
Color("candy1.oth", 1) will pick 1st color in Candy1 color list. It will first search uff folder than system folder for the file name

Color("BlueOrange2.pal", 1) will pick 1st color in BlueOrange2.pal palette file. It will first search uff folder than system folder for the file name

use Set %c -c color("candy.oth", 2) to set plot color to 2nd color of Candy color list.


Great improvement!
Set %c -c color("candy.oth", 2)

What does %c stand for?

quote:
Originally posted by snowli
Sorry that I may have missed your last question about saving color as text file. I suppose u can use our Color Editor app to load palette and color list. It will have R, G, B, HTML color columns created. U can export selected columns as ascii file.


Got it!
Thanks.

---
Andrey

Edited by - AKazak on 10/10/2021 12:06:35 PM
Go to Top of Page

snowli

USA
1386 Posts

Posted - 10/11/2021 :  2:35:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andrey,

See the attached opju.

https://my.originlab.com/ftp/forum_and_kbase/Images/recession_bar_sample.zip

%C means current plot.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 10/13/2021 :  2:20:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Hi Andrey,

See the attached opju.

https://my.originlab.com/ftp/forum_and_kbase/Images/recession_bar_sample.zip

%C means current plot.

Thanks, Snow



Dear Snow,

OK, it is clear to me now.
How do I color adjacent regions in different colors instead of doing alternate fill?

---
Andrey
Go to Top of Page

snowli

USA
1386 Posts

Posted - 10/13/2021 :  3:04:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andrey,

This only supports alternating filling.

Do you mean u want to control the colors between each zones?
Is setting layer background color good enough?

You may want to use reference lines of axis.

Thanks, Snow
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 10/14/2021 :  10:16:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Hi Andrey,

This only supports alternating filling.

Do you mean u want to control the colors between each zones?
Is setting layer background color good enough?

You may want to use reference lines of axis.

Thanks, Snow



Can you share an example of this, please?

---
Andrey
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 12/30/2021 :  10:40:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Any updates on the topic?

---
Andrey
Go to Top of Page

snowli

USA
1386 Posts

Posted - 12/30/2021 :  2:29:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andrey,

Please see the attached opju file. The instruction is in notes window.
https://my.originlab.com/ftp/forum_and_kbase/Images/span_vertically_by_pair.opju

Basically to fill zones defined by X pairs, u will need to plot any Y plot with x pair values as X column.

Thanks, Snow

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