Having Trouble Graphing the point for PRCP. please help.

Having Trouble Graphing the point for PRCP. please help.

1 Commento

Please paste your code as text (preferably formatted) rather than screen shots. Please also upload your xlsx file using the paperclip button.

Accedi per commentare.

Risposte (1)

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.

Categorie

Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange

Richiesto:

il 24 Apr 2024

Risposto:

il 20 Set 2024

Community Treasure Hunt

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

Start Hunting!

Translated by