I want to create a scatter plot of rainfall for specific days. How would I do that from the code below?

1 visualización (últimos 30 días)
% [jday, year, pressure, temp, wspeed, wdirn, dewtemp, wgust, vis, month, day, hours, mins] = ReadRain(fname) % % Create Rainfall Plots for the Specified Period Based on Different Wind % Speed Categories % % INPUTS: % fname : name of file to read % % OUTPUTS: % jday : time (in Julian days since 1st Jan) % year : year % temp : temperature (degC) % wspeed : wind speed (knots) % wdirn : wind direction (degrees) % dewtemp : dewpoint temperature (degC) % precip : rainfall (mm) % % % % Author : Thomas Dent-Jones <mailto:ee10tdj@leeds.ac.uk ee10tdj@leeds.ac.uk> % Created : 19/02/2014 % Last modified : 19/02/2014 %
[jday, year, precip, month, day, hours, mins, id, cnt] = ReadRain('Rain_daily_Cornwall_2013_v2.csv');
[jdayw, yearw, pressure, temp, wspeed, wdirn, dewtemp, wgust, vis, monthw, dayw, hoursw, minsw, station] = WindReader3808('Winds_hourly_Cornwall_2013_v2.csv');
stnlist = unique(id);
n = length(stnlist);
totprecip = zeros(n,1);
ndays = zeros(n,1);
day1 = 91;
day2 = 244;
days = day1:day2;
precip2 = NaN*ones(length(days),n);
for i=1:n
jday1 = jday(id==stnlist(i));
precip1 = precip(id==stnlist(i));
for j=1:length(precip1)
precip2(days==jday1(j),i)=precip1(j);
end
totprecip(i) = sum(precip1);
ndays(i) = length(precip1);
end
%Creating the scatter plot.
[height, lon, lat, sid] = Station('Cornwall_station_details2_with_height.csv');
x = zeros(n,1);
y = zeros(n,1);
h = zeros(n,1);
for i=1:n
x(i) = lon(sid == stnlist(i));
y(i) = lat(sid == stnlist(i));
h(i) = height(sid == stnlist(i));
end
axis([-5.6 -4.2 50 50.9])
img = imread('Cornwall.jpg'); %# Load a sample image
hold on; %# Add to the plot
image([-5.6 -4.2], [50.9 50],img); %# Plot the image
scatter(y(jday=214&jday=215),x(jday=214&jday=215),100,totprecip(jday=214&jday=215),'filled','MarkerEdgeColor','black');
colorbar;
caxis([120 500])
xlabel('longitude');
ylabel('latitude');
%days=214&days=215
  1 comentario
Star Strider
Star Strider el 26 de Mzo. de 2014
The important issue here is not your code but what your data look like and what you want to plot. Obviously one independent variable is time (date and possibly hour) and one dependent variable is rainfall. That may be all you need, but you can plot rainfall against one other independent variable if you want to.
You would do that from the output of the code you posted, if I’m reading your question correctly.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by