I am writing a script to automatically plot some data that includes a mosaic plot. The default order of the response (Y axis) is alphabetical. I would rather have it go from largest percentage to smallest (from the population as a whole) so that the largest blocks are always on the bottom and the smallest on the top (although I'm aware it won't be like that for all the factors, but in my case it will generally be true). Is there a way to do that? I'm thinking one way to trick it would be to create a new column that put a number representing the rank in front of the description, but I'm not even sure of the best way to do that. Thanks.
Another question related to the mosaic plots: I am wanting to label the chart so that the percentage is shown in each of the cells, but I only want it for the first two cells of each variable on the x axis. I can get it working for all the cells in the chart, but I would rather have it only on the first two cells.