Having Trouble Graphing the point for PRCP. please help.
1 回表示 (過去 30 日間)
古いコメントを表示
Having Trouble Graphing the point for PRCP. please help.




1 件のコメント
Voss
2024 年 4 月 24 日
Please paste your code as text (preferably formatted) rather than screen shots. Please also upload your xlsx file using the paperclip button.
回答 (1 件)
Sandeep Mishra
2024 年 9 月 20 日
Hi Luke,
Upon debugging the code, I observed that you are using 'mean' function with a dimension parameter of 1, which calculates the mean across the columns.
However, since 'PRCPdata' is a 948x1 size vector, the result of 'mean(PRCPdata,1)' is a 1x1 scalar value, so the code snippet is trying to plot the ‘years’ vector with only one data point.
Here, the empty plot issue arises due to the default marker being set to 'None' in the plot function.
This issue can be resolved by updating the plot function to include ‘Marker’ as follows:
plot(years, mean(PRCPdata,1), 'ro')
For more information, you can refer to a similar MATLAB Answers post trying to plot with single data points: https://www.mathworks.com/matlabcentral/answers/450503-anyway-to-plot-one-point#answer_1061855
Please refer to the following MathWorks Documentation to learn more about ‘Marker’ property of ‘plot’ function in MATLAB: https://www.mathworks.com/help/releases/R2024a/matlab/ref/plot.html#:~:text=Dash%2Ddotted%20line-,Marker,-Description
I hope this helps in resolving the encountered issue.