So I am trying to draw a grouped bar chart with the legend on the top right corner but not overlapping the chart. The closest thing to what I want is the groupedbar from StatPlots. The problem is that currently the chart is covered by the legend as such:
I also want the bars to be black and white not colored. I couldn’t find enough bar chart examples, and I am not sure how to explore all the valid kwargs in a function. Any help or alternative is appreciated, also general tips on how to find my way around Julia’s plotting ecosystem.
You can change the legend position by legend = :topleft but I think what you need here is the plotting area to have a bigger extent ylim = (0,1.2). To get black and white bars delete your lw = 0 (lw is linewidth; or set it to 0.5) and set fillcolor = :white. Note that if you’re in black and white you won’t be able to use the color legend, and should perhaps just set legend = false. In general the Plots ecosystem (RecipesBase, PlotUtils, PlotThemes, StatPlots and PlotRecipes) is documented at https://docs.juliaplots.org , you’ll see all of the things I’ve just described (in fact all possible kwargs - there are many!) under the “manual/attributes” tab.
Thanks for your response and the pointer. But what I meant by black and white is that they should still be distinguishable so using different patterns instead of different colors. Is this possible?
Right, my bad - from my quick glance over the documentation, I can’t find anything specifying the fill pattern though. Have you set a color (e.g. black) for the plot you just tried? It might be that combining these two can achieve what you’re looking for. Is there a specific reason why you want them to be black and white instead of colored or grayscale?
In theory, Plots should be able to do all the things your chosen backend supports. I’m not an expert using Plots and its various backends though.
There are no greyscale pattern fills in Plots, unfortunately. I know some (few) newspapers and even some scientific journals still only print black and white, so it would be a useful thing to have. If some of the backends (like GR or PyPlot) supports this natively it should be fairly easy to add support.
I wonder, is there a way to make the plot respect the order of the bars given in group kwarg, e.g. SIMP then CSIMP, etc.? It seems to alphabetically order them.