I have a data frame containing order data for each of 20+ products from each of 20+ countries. I have put it in a highlight table using ggplot2
with code simila
The y-axis on your chart is also already ordered alphabetically, but from the origin. I think you can achieve the order of the axes that you want by using xlim
and ylim
. For example:
ggplot(mymelt, aes(x = industry, y = variable, fill = value)) +
geom_tile() + geom_text(aes(fill = mymelt$value, label = mymelt$value)) +
ylim(rev(levels(mymelt$variable))) + xlim(levels(mymelt$industry))
will order the y-axis from all regions
at the top, followed by americas
, and then europe
at the bottom (which is reverse alphabetical order, technically). The x-axis is alphabetically ordered from all industries
to steel
with cars
in between.