Getting a series in a chart to have different colours for each series item - excel-2007

I have 10 items:
Col1, Col2
One, 1
Two, 7
Three, 45
Four, 2
etc...
By default each series is one colour, so each bar in the chart is the same colour. I would like each bar to have a different colour or gradient.
I can do it by switching the labels to be at the side, but I would like the labels of the series to be on the bottom.

Select a data point (a bar),
Right click > Format Data Point > Fill > Select vary colours by point.
It adds a legend to the right, but you can remove that if you want.

Related

Plotting bar plots for categorical variables in STATA

I have a survey data baseline and endline. I am trying to plot bar plot for qualification of the respondent in each group (baseline/endline).
I am using the following code:
graph bar, over(qualification) over(time)
It is giving me different output from what I want.
I want the bars for endline and baseline for each category to be present parallel.
I am also attaching a reference picture to get the better idea about what I want.
The order of the over options of graph bar matters.
Consider this example:
clear
input x str1 a b
1 "a" 1
2 "a" 2
3 "b" 1
4 "b" 2
end
graph bar x, over(a) over(b) title("over(a) over(b)")
graph bar x, over(b) over(a) title("over(b) over(a)")
It looks like you need to swap the order of your over options.

How to plot column chart with bars for 2 categories next to each other?

I need to draw chart like this one. I have 2 categories, named 0 and 1. I want to plot "age vs amount" etc with 2 categories compared next to each other.
df.groupby(by = df['target']).plot(kind='bar')
but it draws 2 separate charts.
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.bar.html
You can find the sub-plot documentation here for making a bar chart like your requirement

Migradoc - aligning a table vertically

I would like to position my table by controlling its placement both vertically and horizontally.
I can place it horizontally using the following:
Commodtable.Rows.LeftIndent = "5cm"
How do I do the same but vertically? I know there is verticalalignment but there are only 3 options: Top, Middle and bottom.
This is so i can eventually place 6 tables in a 3 x 2 arrangement.
To get the 3 x 2 arrangement you can add tables to a table.
See this post:
https://stackoverflow.com/a/36304148/162529
Do draw a table at an absolute position you can add the table to a TextFrame object.
But to get the 3 x 2 arrangement, I would probably prefer nested tables.

Plotting count in Excel

My data is like :
Portfolio Type of Assets Count
Portfolio 1 Type A 10
Type B 5
Type C 7
Portfolio 2 Type A 5
Type B 10
I am trying to plot a Bar graph where the each bar will have Portfolio 1 or similar on x-axis, the count of assets on the bar representing different colors and labels of colors like Red area in a bar represents the Type A assets. How can I plot that, I have tried this for a very long time, but not able to get it. Can anyone throw some hint please?
Click here and watch a YouTude, you will discover select data.

Bar and Line charts are not synced when in the same chart area

I have problem with a chart in vb.net. The problem is that line and bar are not synced in the chart area. I've attached a picture to make it clear what I mean
Here is the code where I populate the chart. I´m getting the data from a database.
Dim theDate As Date
For i As Integer = Count - 1 To 0 Step -1
'Chart1.Series("serRxTime").Points.AddY(dv(i)(0) / 60)
theDate = dv(i)(1)
Chart1.Series("serTime").Points.AddXY(theDate.ToString("dd-MMM HH:MM", enUS), dv(i)(0) / 60)
Chart1.Series("serAdd").Points.AddY(dv(i)(2))
Next
Line and column series have the same XValues that's why their centres are aligned. You would need to generate different XValues for the two series. XValues that are offset by a small margin. Something like this:
Chart1.Series("serTime").XValues = {0.8, 1.8, 2.8, 3.8,,...,count - 0.2}
Chart1.Series("serAdd").XValues = {1, 2, 3, 4,..., count}
I used 0.2 difference, but this will be different in your case (especially since it seems you have date axis set?). This would push the line series to the left.
I created an example for you. On the first picture you can see the data for the columns. Their x values are 1,2,3,4,...,12 and their y values are marked with blue.
And this is the values for the XY chart. As you can see I moved the x values by 0.2 to the left.