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

조회 수: 7 (최근 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일
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일
편집: A Poyser 2025년 2월 11일
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일
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일
I did this slightly differently, I cheated and used chatGPT to figure it out
A Poyser
A Poyser 2025년 2월 12일
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 CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by