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

38 ビュー (過去 30 日間)
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 件のコメント
dpb
dpb 2025 年 2 月 10 日 21:56
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

サインインしてコメントする。

採用された回答

A Poyser
A Poyser 2025 年 2 月 11 日 14:35
編集済み: A Poyser 2025 年 2 月 11 日 14:36
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

その他の回答 (1 件)

Steven Lord
Steven Lord 2025 年 2 月 10 日 22:07
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 件のコメント
A Poyser
A Poyser 2025 年 2 月 11 日 14:35
I did this slightly differently, I cheated and used chatGPT to figure it out
A Poyser
A Poyser 2025 年 2 月 12 日 10:30
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by