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
 Customize pattern color in legend of bar charts
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

luckne

3 Posts

Posted - 05/19/2025 :  11:15:49 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have a question similar to an old thread (https://my.originlab.com/forum/topic.asp?TOPIC_ID=46599).
I would like to create a legend of a bar chart, or to be more precise for a plot of the type "Grouped Columns - Indexed Data". And I would like to maintain the ability of the legend to update itself based on the changes I make regarding colors, patterns, and so on.

As far as I know and according to https://www.originlab.com/doc/en/LabTalk/ref/Legend-Substitution-Notation#Legend_Text_Customization, the symbols in the legend can be present
the original bar (\l(1)),
the fill color (\l(1, style:C) or more precise \l(1,1,2)),
the pattern by itself (\l(1, style:P), always in black),
the pattern with a custom fill color (\l(1, style:P#191970)),
the border color (\l(1, 1, 1)),
and the pattern color by itself (\l(1,1,3)).

However, there seems to be no option to customize the pattern color without changing the color itself in the plot or create a "dummy-plot". E.g. the block for AN-17 should have the white background, but the pattern is supposed to be dark blue (e.g. #000080), while in the plot the pattern can be gray, dark green, and dark red.


I would like to know if there's an option similar to the one explained in the other linked thread for symbols, where the option "edgecolor" can be added to the legend text to customize the pattern color. I am aware that I could simply add custom blocks to the legend, but then I would need to edit them every time manually in case I would select a different pattern for this dataset.

Thanks for the help!

Origin Ver. and Service Release: OriginPro 2024 SR1, 10.1.0.178
Operating System: Windows 10

Edited by - luckne on 05/19/2025 11:31:26 AM

ChaoC

USA
187 Posts

Posted - 05/19/2025 :  2:21:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello luckne,

You can use \L(1,PatternColor:#) where # can be LabTalk color index or HTML color code.

Best,
Chao
Go to Top of Page

luckne

3 Posts

Posted - 05/19/2025 :  3:56:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by ChaoC

Hello luckne,

You can use \L(1,PatternColor:#) where # can be LabTalk color index or HTML color code.

Best,
Chao



Hi Chao,

this works indeed pretty perfectly.
Now I'm wondering, since I've tried that as well now, if there is a way to manipulate both pattern color and fill color through a combination of \L(1,style:P#) and \L(1,PatternColor:#) or if they are mutually exclusive. From my own trial, just listing them after each other with a comma as separator does not yield a combined result but the first listed item is the dominant one, i.e. using

\L(1, Style:P#000000, PatternColor:#191970)
(#191970 is Midnight Blue) would yield the same output for - say - AN-26 as in the original image, whereas

\L(1, PatternColor:#191970, Style:P#000000)
yields this:


The grey background is the original background of the dataset referred to in the legend, therefore ignoring the style:P#000000 command.

Thanks anyways for the help!
Best,
Lucas
Go to Top of Page

ChaoC

USA
187 Posts

Posted - 05/20/2025 :  12:57:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Lucas,

Try it without the commas:
\L(1, PatternColor:#191970 Style:P#000000)

Best,
Chao
Go to Top of Page

luckne

3 Posts

Posted - 05/21/2025 :  10:38:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Chao,

that worked like a charm, thanks so much for the help.

Best, Lucas
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