I am trying to recreate a plot from a literature review. It is a scatter graph but the axis are labels more than specific numbers

6 views (last 30 days)
I want to recreate this graph. I have used web plotter to extract all the data but defining the axes and the number of subcatagories is proving somewhat confusing. Each data point has a shape and a colour that represents the material and the country respectively.
  1 Comment
dpb
dpb on 10 Feb 2025
The axis ticklabels are written as text although the data are datetime values on time axis,
Similarly for the y-axis; the data will have to be numeric but the ticks and ticklabels can then be set where desired.
The markerstyle and color are set by the individual data points

Sign in to comment.

Accepted Answer

A Poyser
A Poyser on 11 Feb 2025
Edited: A Poyser on 11 Feb 2025
This is how I did it
% Define machining methods and their left y-axis values
methods = {'Laser', 'EDM', 'Mechanical', 'WaterJet'};
y_left = [10, 30, 55, 90]; % Left Y-axis values
x = zeros(size(y_left)); % All x-values are 0
% Create a figure and plot the data
figure;
plot(x, y_left, 'bo', 'MarkerSize', 8, 'LineWidth', 2); % Blue circular markers
% Customize the axes
xlabel('X Axis (Fixed at 0)');
ylabel('Left Y Axis Values');
title('Left Y Axis Values at X = 0');
grid on;
% Set x-axis limits for clarity
xlim([-1, 1]); % To keep x=0 clear
ylim([0, max(y_left) + 10]); % Adjust y-axis range for visibility
% Add left-justified text labels
hold on;
for i = 1:length(y_left)
text(x(i) - 0.1, y_left(i), methods{i}, 'FontSize', 10, ...
'VerticalAlignment', 'middle', 'HorizontalAlignment', 'left'); % Left-justified
end
hold off;
I also set the limits and removed the markers, justified the labels and such but this is the basis of how I did it

More Answers (1)

Steven Lord
Steven Lord on 10 Feb 2025
I'm not certain what the significance of the unlabeled horizontal lines are, but you can create a scatter plot with categorical and/or datetime data on the axes.
sz = ["Small", "Medium", "Large"];
C = categorical(sz, sz, Ordinal=true) % Ordinal because the sizes have an order
C = 1x3 categorical array
Small Medium Large
scatter([2 1 3], C)
title("Numeric X data, categorical Y data")
figure
dt = datetime([2025 2015 2020], 1, 1);
scatter(dt, C)
title("Datetime X data, categorical Y data")
  2 Comments
A Poyser
A Poyser on 12 Feb 2025
Also I should ass the second horizontal lines are the right hand axis ffor sub categories of the left axis, so for mechanical you have drilling, grinding, etc.

Sign in to comment.

Categories

Find more on Discrete Data Plots in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!