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
 All Forums
 Origin Forum
 Origin Forum
 Customize pattern color in legend of bar charts

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
luckne Posted - 05/19/2025 : 11:15:49 AM
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
4   L A T E S T    R E P L I E S    (Newest First)
luckne Posted - 05/21/2025 : 10:38:11 AM
Hello Chao,

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

Best, Lucas
ChaoC Posted - 05/20/2025 : 12:57:57 PM
Hello Lucas,

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

Best,
Chao
luckne Posted - 05/19/2025 : 3:56:10 PM
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
ChaoC Posted - 05/19/2025 : 2:21:02 PM
Hello luckne,

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

Best,
Chao

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000