Reputation: 1316
I am trying to draw a boxplot using only Q1, Q3, Max, Min and Mean values as I don't have the whole data, can anyone help me with that?
Thanks
Upvotes: 2
Views: 596
Reputation: 5089
Well, it is not a box plot anymore (the whiskers in a traditional box plot are not set to the minimum and maximum values), so you want to be very clear in the notes about what this chart is showing. But given that information one can build a similar looking chart by superimposing the various elements. Example below:
DATA LIST FREE / Id Min Q1 Mean Q3 Max.
BEGIN DATA
1 1 2 3 4 5
2 1 3 5 7 9
3 1 5 8 8 10
END DATA.
FORMATS All (F2.0).
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=Id Min Q1 Mean Q3 Max
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: Id=col(source(s), name("Id"), unit.category())
DATA: Min=col(source(s), name("Min"))
DATA: Q1=col(source(s), name("Q1"))
DATA: Mean=col(source(s), name("Mean"))
DATA: Q3=col(source(s), name("Q3"))
DATA: Max=col(source(s), name("Max"))
GUIDE: axis(dim(1), label("Id"))
GUIDE: axis(dim(2), label("Variable"))
ELEMENT: edge(position(Id*(Min+Max)))
ELEMENT: bar(position(region.spread.range(Id*(Q1+Q3))))
ELEMENT: point(position(Id*Mean), color.interior(color.grey), size(size."12"))
END GPL.
Upvotes: 2