Plotting count in Excel - vba

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.

Related

How to label a whole dataset?

I have a question.I have a pandas dataframe that contains 5000 columns and 12 rows. Each row represents the signal received from an electrocardiogram lead. I want to assign 3 labels to this dataset. These 3 tags belong to the entire dataset and are not related to a specific row. How can I do this?
I have attached the picture of my dataframepandas dataframe.
and my labels are: Atrial Fibrillation:0,
right bundle branch block:1,
T Wave Change:2
I tried to assign 3 labels to a large dataset
(Not for a specific row or column)
but I didn't find a solution.
As you see, it has 12 rows and 5000 columns. each row represents 5000 data from one specific lead and overall we have 12 leads which refers to this 12 rows (I, II, III, aVR,.... V6) in my data frame. professional experts are recognised 3 label for this data frame which helps us to train a ML Model to detect different heart disease. I have 10000 data frame just like this and each one has 3 or 4 specific labels. Here is my question: How can I assign these 3 labels to this dataset that I mentioned.as I told before these labels don't refers to specific rows, in fact each data frame has 3 or 4 label for its whole. I mean, How can I assign 3 label to a whole data frame?

Sequence function on existing data

picture of example dataset
I am looking for a function to change the values from 0,1,2,3,4,5,6 etc. to every 5 in R. I have a big dataset similar to column A and B and would like to change it to columns H and I (like shown in the attached picture).
I'd like to change every cm til every 5 cm so that species that covers 5cm or shorter than 5 cm are registered as a point (similar to equ_palu). Moreover, the specie bet_nana covers 0-10 cm and is therefore registered as 5 and 10 in column H and I.

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

VBA to find maximum value in a chart

I have a range of data columns A, B, and C. I have displayed as a line graph with B as the primary axis and C as the secondary axis. Column A is the category axis. I want to find the maximum value of column C and put a data callout on the point that is the maximum of column C and where column B occurs.
I know this sounds confusing. In this example, the maximum of Column C occurs at Point 27 (or 1.50% on the category axis). I would like a dot at point 27 for both Column B and C.
Column A is percentage from -5.00 to 10.00 incremented at .25%. Columns B and C are plotted against the change.
In the past I have done something similar, use a formula in column D to identify the largest number in Column C and B and make it a value high on your chart if the result is true.
Add Column D as a series to the chart.
Change the chart type on that series only to a scatter chart or something that puts points up there.
You can put a label on or simply put the amount showing above the plotted point.
You don't need VBA for this.
You might be interested to know I found a solution that works for me. First, I added columns D and E using the formula =IF(C2=MAX(C$2:C$62),C2,NA()) and =IF(C2=MAX(C$2:C$62),B2,NA()), this gave me the point on the graph for both lines B and C where B was maximum. I then formatted the graph so that these points had data callouts (a request from the client). Finally, I set columns D and E to have white font, to match the background so the appear invisible. I don't love this step, but I don't want the client to see the extra rows of #NA, etc.
The basic VBA for data callout is ActiveChart.FullSeriesCollection(5).Select
ActiveChart.SetElement (msoElementDataLabelCallout)
Where the series is 5 (column E) and I'm putting a data callout on the graphed point, which happens to be the maximum of column 3.