Help with graphing table into line graph
6 ビュー (過去 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!