Closed chelseas closed 3 years ago
Looks like PGFPlots does not add the ybar
option to the axis
:
julia> println(tikzCode(fig))
\begin{axis}
\addplot+ coordinates {
(1, 1)
(2, 2)
};
\end{axis}
You can try this:
The issue with the original code is that fig = PGFPlots.Axis()
creates an axis with no properties, and to get this kind of axis plot, the ybar
property of the axis needs to be set.
The problem with this solution is that I would like to make a grouped bar chart by pushing multiple BarCharts onto a single Axis. One solution is to manually set ybar in the latex code but is there another solution?
You can create the Axis using my method with the first bar chart, and then push on additional bar charts to that axis.
Your method returns an object of type
PGFPlots.Plots.BarChart
but I'm guessing perhaps there's some way to extract the associated Axis object?
I think you can do this:
fig = PGFPlots.Axis()
push!(fig, PGFPlots.Plots.BarChart([1,2]))
PGFPlots.save("test_bar.pdf", fig)
produces