Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.9K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Different ChartBaseStyle for each bar in a bar graph

Posted 5 years ago

Hi I have some code as below to draw a bar graph, at the moment I can set the border of each bar using "ChartBaseStyle" option, which sets the border around each bar to "Black". I would like to set different color border for each bar, below code generates 3 sets of bars colored "light gray" and "dark gray". I want to have no border for light gray bars and a black color border for dark gray bars is this achievable using "ChartelementFunction" option, if so can anyone please help me on this. Thanks Nalina

levels = GrayLevel /@ {0.9, 0.5};

data1 = {{0.25, 0.4}, {0.172, 0.25}, {0.101, 0.26}};
BarChart[data1, BarSpacing -> {0.15, 1}, PlotTheme -> "Business", 
ChartLegends -> {Text[Style["BXE", 12]], Text[Style["TQ", 12]]}, 
ChartStyle -> levels, LabelingFunction -> Above, 
ChartLabels -> {{"Large", "Small", "Overall"}, None}, 
BaseStyle -> Directive[FontSize -> 11], 
PlotLabel -> Style["Volume", FontSize -> 15], 
ChartBaseStyle -> 
Directive[EdgeForm[{Thin, RBAGreys[10], Opacity[1]}]]]
POSTED BY: Nalina Vemparala
4 Replies
Posted 5 years ago

What is the definition of levels?

POSTED BY: Rohit Namjoshi

Hi Rohit

levels = GrayLevel /@ {0.9, 0.5};

Sorry I missed it.

Thanks. Nalina

POSTED BY: Nalina Vemparala
Posted 5 years ago

Hi Nalina,

Is this what you are looking for?

BarChart[{Style[#, EdgeForm[None]], Style[#2, EdgeForm[{Black, Thick}]]} & @@@ data1,
 BarSpacing -> {0.15, 1},
 PlotTheme -> "Business",
 ChartLegends -> {Text[Style["BXE", 12]], Text[Style["CXE", 12]]},
 ChartStyle -> levels,
 LabelingFunction -> Above,
 ChartLabels -> {{"Large", "Small", "Overall"}, None},
 BaseStyle -> Directive[FontSize -> 11],
 PlotLabel -> Style["Volume", FontSize -> 15]]

enter image description here

POSTED BY: Rohit Namjoshi

Hi Rohit Yes this is what I wanted, I also worked out this code myself, but I want it more like an option some function I can use for "ChartStyle", or "ChartElementFunction" or "ChartBaseStyle" options, is this possible.

Thanks Nalina

POSTED BY: Nalina Vemparala
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard