Help with graphing table into line graph
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello,
I am trying to graph a table into a line graph. The table is 4 columns: Outside Diameter(in), Wall Thickness(in), Stress(PSI), and Safety Factor.
I am having trouble formatting the table into a line graph that can show all the values.
The safety factor values are so low that the line is barely visibile to nonexistent.
What would be the proper way to format this? Is there a function for something like this?
Thank you
댓글 수: 3
Dyuman Joshi
2023년 11월 28일
편집: Dyuman Joshi
2023년 11월 28일
"Ideally, I was looking a single graph/plot that can showcase all 4 columns accurately."
If the scaling of the 4 data-sets are quite different, one option is to use log scales on yaxis. However, this would not work as expected if there is negative or 0 values in the data.
답변 (1개)
Peter Perkins
2023년 11월 28일
This spreadsheet is kind of messed up, and I will let you figure out how best to read it in. Given that, it seems like stackedplot would be useful.
t = readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1554152/Data.xlsx");
t.OD_in_ = [1;1;1;1;1.25;1.25;1.25;1.25;1.5;1.5;1.5;1.5;1.75;1.75;1.75;1.75];
t.WT_in_ = [3/25;5/32;3/16;1/4;3/25;5/32;3/16;1/4;3/25;5/32;3/16;1/4;3/25;5/32;3/16;1/4];
t
stackedplot(t)
This uses a table. You might also want to look at timetables to plot vs. time, but I actually don't think that's what you are doing. In fact, it seems like you really want a surface plot of x and SF vs. OD and WT. But that's not what you described.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!