diff --git a/@msh/msh.m b/@msh/msh.m index 9d96ffc9..52f52586 100644 --- a/@msh/msh.m +++ b/@msh/msh.m @@ -335,6 +335,7 @@ function write(obj,fname,type) proj = 1; axis_limits = []; % use mesh extents to determine plot extents cmap = 1; % default value is specified in plot method + leg_ind = []; projtype = []; type = 'tri'; @@ -375,7 +376,7 @@ function write(obj,fname,type) projtype = MAP_PROJECTION.name; else error(['no native projection in msh class, please specify the plotting projection: ' ... - 'plot(m,''proj'',''lamb''), or no projection: plot(m,''proj'',''none'')']) + 'plot(m,''type'',''tri'',''proj'',''lamb''), or no projection: plot(m,''type'',''tri'',''proj'',''none'')']) end end @@ -445,6 +446,8 @@ function write(obj,fname,type) simpplot(obj.p,obj.t); end case('bd') + legend_names = {'open ocean boundary','outer no-flux boundary',... + 'inner no-flux boundary','subgrid scale barriers'}; if tri if proj m_triplot(obj.p(:,1),obj.p(:,2),obj.t); @@ -455,35 +458,44 @@ function write(obj,fname,type) if ~isempty(obj.bd) for nb = 1 : obj.bd.nbou if obj.bd.ibtype(nb) == 24 || obj.bd.ibtype(nb) == 94 + if sum(leg_ind == 4) == 0 + leg_ind(end+1) = 4; + end if proj % plot front facing m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2); % plot back facing - m_plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),... + h(4) = m_plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),2),'y-','linewi',1.2); else % plot front facing plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2); % plot back facing - plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),... + h(4) = plot(obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.ibconn(1:obj.bd.nvell(nb),nb),2),'y-','linewi',1.2); end elseif obj.bd.ibtype(nb) == 20 + if sum(leg_ind == 2) == 0 + leg_ind(end+1) = 2; + end if proj - m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... + h(2) = m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'r-','linewi',1.2); else - plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... + h(2) = plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'r-','linewi',1.2); end else + if sum(leg_ind == 3) == 0 + leg_ind(end+1) = 3; + end if proj - m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... + h(3) = m_plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2); else - plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... + h(3) = plot(obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),1),... obj.p(obj.bd.nbvv(1:obj.bd.nvell(nb),nb),2),'g-','linewi',1.2); end end @@ -491,11 +503,14 @@ function write(obj,fname,type) end if ~isempty(obj.op) for nb = 1 : obj.op.nope + if sum(leg_ind == 1) == 0 + leg_ind(end+1) = 1; + end if proj - m_plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),... + h(1) = m_plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),... obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),2),'b-','linewi',3.2); else - plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),... + h(1) = plot(obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),1),... obj.p(obj.op.nbdv(1:obj.op.nvdll(nb),nb),2),'b-','linewi',1.2); end end @@ -713,6 +728,9 @@ function write(obj,fname,type) % now add the box m_grid('FontSize',fsz,'bac',bgc); end + if ~isempty(leg_ind) + legend(h(leg_ind),legend_names(leg_ind),'location','best') + end function plotter(cmap,round_dec,yylabel,apply_pivot) % applies the plot for the quantiy 'q' and specific diff --git a/README.md b/README.md index 921db845..2e685085 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Besides posting [issues](https://github.com/CHLNDDEV/OceanMesh2D/issues) with th Note: If the slack link invite isn't working, please send either one of us and an email and we'll fix it. By default, the invite link expires every 30 days. -Otherwise please reach out to either Dr. William Pringle (wpringle@anl.gov) or Dr. Keith Roberts (krober@usp.br) with questions or concerns or feel free to start an Issue in the issues tab above. +Otherwise please reach out to either Dr. William Pringle (wpringle@anl.gov) or Dr. Keith Roberts (keithrbt0@gmail.com) with questions or concerns or feel free to start an Issue in the issues tab above. Contributing @@ -148,6 +148,9 @@ Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Unreleased (on current HEAD of the Projection branch) +- None + +### [5.0.0] - 2021-07-29 ## Added - `meshgen.build()` now will rewind the iteration set in the case mesh improvement cannot improve the qualities. https://github.com/CHLNDDEV/OceanMesh2D/pull/234 - `msh.plot()` now has a `cmap` in which the user can specify their any `cmocean` colormap @@ -163,6 +166,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - tidal constituents for `Make_f15` can now contain "major8" in addition to other constituents in the string/cell array https://github.com/CHLNDDEV/OceanMesh2D/pull/221 - Correctly collect NDBC and NOS stations in mesh when creating `fort15` file using `Make_f15` for meteorological, velocity and elevation records https://github.com/CHLNDDEV/OceanMesh2D/pull/242 ## Changed +- `msh.plot()` using type `bd` option now creates a legend for the different boundary condition types. https://github.com/CHLNDDEV/OceanMesh2D/pull/247 - forcing facecolor to white in `m_trimesh` so that it does not intefere with background color option. https://github.com/CHLNDDEV/OceanMesh2D/pull/245 - made topographic elevation bound option for max_ele, wl, slp, and g `edgefx` kwargs consistent and added explanation of this option is included in `edgefx` help. https://github.com/CHLNDDEV/OceanMesh2D/pull/230 - `m_plot()` function calls `m_grid()` with background color input kwarg (if `backcolor` option used) instead of manual application. https://github.com/CHLNDDEV/OceanMesh2D/pull/225