# How to plot individual concentration vs time plot by group?

13 views (last 30 days)
voZnW on 3 Oct 2022
Commented: Cheliza on 20 Apr 2023
My data has 12 individual concentration data, they were divided into three dose groups with four individuals in each group. I want to plot individual concentration vs time plot by different dose group. But the "creat set" function can only separate by different species like concentration in central compartment or concentration in peripheral compartment. How to plot individual concentration vs time plot by dose group?
Cheliza on 20 Apr 2023
You can plot individual concentration vs time plot by different dose groups by using the 'hold on' command to plot each individual data set separately.
Here's an example code that shows how to plot individual concentration vs time plot by dose group:
% Sample data
dose_group_1 = [1 2 3 4];
dose_group_2 = [5 6 7 8];
dose_group_3 = [9 10 11 12];
time = [0 1 2 3];
% Plot individual concentration vs
time plot for dose group 1
plot(time, dose_group_1(1,:), '-o')
hold on
plot(time, dose_group_1(2,:), '-o')
plot(time, dose_group_1(3,:), '-o')
plot(time, dose_group_1(4,:), '-o')
xlabel('Time (hours)')
ylabel('Concentration')
title('Individual concentration vs time plot for dose group 1')
legend('Individual 1', 'Individual 2', 'Individual 3', 'Individual 4')
% Plot individual concentration vs time plot for dose group 2
figure
plot(time, dose_group_2(1,:), '-o')
hold on
plot(time, dose_group_2(2,:), '-o')
plot(time, dose_group_2(3,:), '-o')
plot(time, dose_group_2(4,:), '-o')
xlabel('Time (hours)')
ylabel('Concentration')
title('Individual concentration vs time plot for dose group 2')
legend('Individual 1', 'Individual 2', 'Individual 3', 'Individual 4')
% Plot individual concentration vs time plot for dose group 3
figure
plot(time, dose_group_3(1,:), '-o')
hold on
plot(time, dose_group_3(2,:), '-o')
plot(time, dose_group_3(3,:), '-o')
plot(time, dose_group_3(4,:), '-o')
xlabel('Time (hours)')
ylabel('Concentration')
title('Individual concentration vs time plot for dose group 3')
legend('Individual 1', 'Individual 2', 'Individual 3', 'Individual 4')
In this example, each dose group is represented by a row in a matrix, with each column corresponding to an individual's data. The 'hold on' command is used to plot each individual's data on the same graph. The 'figure' command is used to create a new figure for each dose group. The 'xlabel', 'ylabel', 'title', and 'legend' commands are used to label the plot and provide a legend for the individual data sets.

Fulden Buyukozturk on 3 Oct 2022
Edited: Fulden Buyukozturk on 3 Oct 2022
If you have a column in your dataset with the dose info, you can use this column to slice the data using Visual Channels. Please see the screenshot below. Here the column with dose information is "Dose_nanomole".

### Communities

More Answers in the  SimBiology Community

### Categories

Find more on Import Data in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!