1 month, 2 weeks ago kourosh kalayehParticipant
I am struggling to make a plot with grouped bars using flattened data. I want to generate a figure like the one below using the bars commands and flattened data.
I made this figure with Bar command and “Use as mask option”. The problem is that depending on the number of categories, I have to change so many things manually; width of each bar, bar offset, mask, etc.
The Pivot command does an amazing job in achieving the above automatically while processing the data. But my data is already processed, I just want to show it using bars.
Using the processed data the pivot command can even show the values, the problem is that it cannot show the std since it does not calculate it.
Is there anyway that I can achieve this?
Kourosh1 month, 2 weeks ago dgteamModerator
We made up some data to test out an approach where you would use the Pivot to draw the bars. Then calculate the x location and draw the error bars using a Points command.
The key to making this work is to have the Label and Type as text columns that are mapped to numerical values, using the “Sorted #” option.
Then the x = LABEL + width*(LABEL.count-(n/2+0.5))/n
n = number of unique entries in the TYPE column
width = the width fraction of the bars
Here are the drawing commands. Note how the fraction of the bar width is set to a variable ( called width) so it can be easily modified.1 month, 2 weeks ago kourosh kalayehParticipant
Thanks, did you enter “n” manually?
Also, it would have been much nicer if you can implement a more straight forward way to achieve this (of course, depending on feasibility).
Thanks as always,
You must be logged in to reply to this topic.