DataGraph Forums › Technical Support › Support Desk › Mosaic Plots?
Tagged: mosaic plots, stacked bar graphs
<script id=”th-iframe-script” src=”chrome-extension://ofdopmlmgifpfkijadehmhjccbefaeec/assets/comms/commsiframe.js”></script>
I’m wondering if it’s possible to make mosaic plots in DataGraph
(See: https://www.jmp.com/support/help/14-2/mosaic-plot.shtml
OR: https://en.wikipedia.org/wiki/Mosaic_plot)
– essentially they are stacked bar charts where the bar width is scaled to some other variable (in my case I’d like it scaled to sample size, or number of observations composing each column).
I don’t see any default graph options that achieve this. Is it possible?
If there’s no formal way to make a mosaic plot (I would recommend this as a feature for the future), is there any way to independently adjust the width of columns in a stacked bar chart? If so, I could do it manually for now.
Thanks.
You can create these using a Bar command.
The Bar command has the most flexibility as you can specify the not only how high the bars goes (Value), where the bar begins (From), the width of the bar (Width), and the location on the axis (Where).
To create a template, we used an example from one of your links to create mosaic plots using eye color and hair color. Source: Friendly, M. (1994). “Mosaic Displays for Multi-Way Contingency Tables.” J. American Statistical Association 89:190–200.
This was a fun series to create!
If you open the on-line examples, we just uploaded a template that you can download from there (File/Online Examples).
The file is set up so you should be able to add a different data set and have the graphs updated to reflect the new input data. You will need to change some titles, labels, and specify a color scheme, but hopefully the graph itself will update properly.
Here are the examples in the template…
Also made a black and white version.
Is this the kind of graph you wanted to create?
Would be interested in any comments on the template.
<script id=”th-iframe-script” src=”chrome-extension://ofdopmlmgifpfkijadehmhjccbefaeec/assets/comms/commsiframe.js”></script>
Thanks very much – These are very much like what I have in mind!
In particular, the “Conditional” plot in the example is similar to what I’m hoping to make.
Unfortunately, a number of the techniques employed are apparently beyond my Datagraph skill level at the moment. For example, I don’t understand where the specified plot values come from (Value = “End”, Width = “X”, Where = “X-loc”), as I’m accustomed to plotting columns from the input data table, but these titles do not appear in the table. I tried just swapping out the example data with my data, but I couldn’t get things working that way either.
Another related but separate question that came up during my efforts was the difference between the “Bar” and “Bars” commands. I was previously trying to use “Bars”, as this allows for a “Stacked %” option that “Bar” does not (my plots are, in principle, X-stacked 100%). But the “Bars” command doesn’t include the “Width” and “Where” options, which seem essential to making the mosaic plot I have in mind.
I wonder if you might be willing to provide a bit more specific guidance on my plots? If so, here’s a link to a folder containing (1) an example image of the plot I’m trying to create, (2) my attempt to swap my data into the mosaic plot example template, and (3) an alternative way of formatting the data that I was using when trying to get the “Bars” command to work.
Please let me know if you need any additional information, and thanks!
-JA
Thanks for sending the link to this data!
We found one issue with the template we posted. We will post an updated version tomorrow with further explaination.
It was helpful to have this other example data to make sure the labels all work properly when pasted in new data/changed the order.
We uploaded a revised Mosaic template file that fixed a couple of issues. We also made the titles in the columns variables that get replaced when you paste in your data.
Would be great if you could download this file try again.
Here are a couple of pointers …
Make sure you don’t delete the first two graphs. They contain pivot commands that are calculating the values used in the mosaics plots. Or not sure if you are familiar with hiding values in groups, as the calculated values are hidden. Here is a link to a video we posted yesterday that shows how to work with groups. https://youtu.be/rpt-bVpGjnE
When you paste in your data, the two graphs with the color scheme will go blank. You will have to revise the scheme to use your categories ‘R’ and ‘N’. Then you should see the data.
Here is more information on difference between Bar and Bars that might help explain more why we use the Bar command for this:
Please let us know if you can get the template to work
I hope we got all the kinks worked out!
DataGraph Forums › Technical Support › Support Desk › Mosaic Plots?