In the Fit Y by x Platform, is it possible to color the boxes by a cloumn? For example, I have a plot of machine efficiencies (y-axis) against the month/year (x-axis) and would like to have different colors for the boxes by year; 2011 - red, 2012 - blue, etc I have tried several things, but cannot get the colors.
If you don't need other features of Fit Y by X than box plots, you could try Graph Builder where box plots can be colored by a variable dragged to the Overlay Role.
Try the example code below. (The code demonstrates PMroz tip about the date format, but in my localization "m/y" has to be typed like "m-y".)
dt = New Table("example",
add rows(360),
New Column("date",
Numeric,
Format("m-y", 7),
formula(Date Increment(Informat("1-2009", "m-y"), "month", Mod(Row() - 1, 36)))
),
New Column("data", numeric, formula(Random Uniform())),
New Column("year", nominal, formula(Year(:date)))
);
dt << Graph Builder(Variables(X(:date), Y(:data), Overlay(:year)), Elements(Box Plot(X, Y, Legend(7))));
Not sure if this is what you meant but I just right clicked and customized the graph to color the box plot.
That does not seem to be working for me at all. Besides, I have 72 boxes (12 months by 6 years). Seems to me I should be able to color the boxes by year. Another issue I am having. I can't find the right format for my "Month" column to make the chart plot the months by time order instead of alphabetical order. I am getting Apr-01, Apr-02, Apr-03, etc. instead of Jan-01, Feb-01, Mar-01, etc. I know I can use the value order function in column prop[erties, but what a tedious task! Any suggestions?
Two suggestions:
1. Use a format that will sort alphabetically, such as 2015-01, 2015-02, 2015-03 etc.
2. Convert your month column to a numeric, and set the format to "m/y".
Can you give us a flavor of what your data looks like?
If you don't need other features of Fit Y by X than box plots, you could try Graph Builder where box plots can be colored by a variable dragged to the Overlay Role.
Try the example code below. (The code demonstrates PMroz tip about the date format, but in my localization "m/y" has to be typed like "m-y".)
dt = New Table("example",
add rows(360),
New Column("date",
Numeric,
Format("m-y", 7),
formula(Date Increment(Informat("1-2009", "m-y"), "month", Mod(Row() - 1, 36)))
),
New Column("data", numeric, formula(Random Uniform())),
New Column("year", nominal, formula(Year(:date)))
);
dt << Graph Builder(Variables(X(:date), Y(:data), Overlay(:year)), Elements(Box Plot(X, Y, Legend(7))));