Reputation: 11
I'm trying to plot some data using Julia, but I'm quite new to Data visualisation in Julia. I have code that looks like this:
x_data = [5 10;
15 20]
groupedbar( ["0.2", "0.8"], x_data, xlabel = "X-axis",
ylabel="Y-axis")
Each x-value (0.2 and 0.8) will have 2 bars each which are different colours. I am trying to create a legend for these colours.
I have tried the following code but it for some reason plots the data incorrectly (only plots the first 2 data points):
groupedbar( ["0.2", "0.8"], x_data, xlabel = "X-axis",
ylabel="Y-axis", group = ["Category 1", "Category 2"])
Upvotes: 1
Views: 1415
Reputation: 69949
Is this what you want?
groupedbar(["A", "A", "B", "B"], [4, 1, 2, 3], group = ["x", "y", "x", "y"])
(note that all three arguments have the same length)
Upvotes: 1