Having Trouble Graphing the point for PRCP. please help.

1 view (last 30 days)
Having Trouble Graphing the point for PRCP. please help.
  1 Comment
Voss
Voss on 24 Apr 2024
Please paste your code as text (preferably formatted) rather than screen shots. Please also upload your xlsx file using the paperclip button.

Sign in to comment.

Answers (1)

Sandeep Mishra
Sandeep Mishra on 20 Sep 2024
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.

Community Treasure Hunt

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

Start Hunting!