<div dir="ltr"><div class="gmail_default" style="font-size:small">Qi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I wasn't displaying the last color in the color bars, so here's a new version of the script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">In order to avoid white as a fill color, I added a function that subsets the color map of interest, so you can indicate what part of the color map to start and end at.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Finally, I got the script to run much faster (from 133 seconds to less than a second) by creating a new version of "get_color_rgba" that allows multiple data values to be input. I will make sure this updated function gets into NCL V6.5.0. Meanwhile, I included it with this new script and called it "get_color_rgba_improved")</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 27, 2017 at 6:27 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Qi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I agree, this is an interesting plot.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The key thing is that you need to do the following:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><ul><li>Use gsn_csm_blank_plot to set up the X and Y axes for whatever limits you need<br><br>This will be based on the number of boxes you need to have in the matrix in both directions. <br><br>You could set up the axes limits to go from 0 to nxbox-1 in the X direction, and 0 to nybox-1 in the Y direction, where "nxbox" will be, say, the number of models you have, and "nybox" is the number of variables.<br><br><a href="http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_blank_plot.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Graphics/Interfaces/gsn_csm<wbr>_blank_plot.shtml</a><br><br></li><li>For each variable and each model, you need to get the four values for each triangle, and color each triangle based on the range it falls in. <br><br>You can use get_color_rgba to pass a color map, a set of numeric levels, and a single value, and it will return an RGBA value that represents the correct color for that value.<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/get_color_rgba.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Built-in/get_colo<wbr>r_rgba.shtml</a><br><br></li><li>You would then use either gsn_polygon or gsn_add_polygon to fill the triangle in that color. I recommend using gsn_add_polygon, so you can actually attach it to the plot (in case the plot needs to be resized later in a panel or some other reason).<br><br><a href="http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polygon.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Graphics/Interfaces/gsn_add<wbr>_polygon.shtml</a><br><br></li><li>Finally, to attach the extra labelbars, you can use gsn_create_labelbar and gsn_add_annotation.</li></ul><div><br></div><div>I realized all of this sounded a bit daunting, so I created a script using dummy data, which I've attached.</div><div><br></div><div>The scrip creates an nvars x nmodels x nlat x nlon dummy array, and then takes the min, max, average, and standard deviation for each nlat x nlon section and used these values to fill in the four triangles in each quadrant.</div><div><br></div><div>This script is somewhat slow in the add_triangles code, and I think this is partly because of the loop that gets the color value for each data point. I will see if I can speed this up.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div style="font-size:small">--Mary</div><div style="font-size:small"><br></div></font></span></div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 26, 2017 at 10:18 AM, LI Qi <span dir="ltr"><<a href="mailto:liqi123sh@qq.com" target="_blank">liqi123sh@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear Mary,</div><div>Thanks for the quick reply.</div><div>My friend asked me the question and he would like to use the quadrants to represent four seasons.</div><div>I'll forward the example to him.</div><div>It's really interesting, like expanding a dimension on the matrix.</div><div>Thanks again,</div><div>Best,</div><div>Qi</div><div><div><br></div><div><br></div><div style="font-size:12px;font-family:Arial Narrow;padding:2px 0 2px 0">------------------ Original --<wbr>----------------</div><div style="font-size:12px;background:#efefef;padding:8px"><div><b>From: </b> "Mary Haley";<<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>;</div><div><b>Date: </b> Wed, Jul 26, 2017 11:53 PM</div><div><b>To: </b> "LI Qi"<<a href="mailto:liqi123sh@qq.com" target="_blank">liqi123sh@qq.com</a>>; </div><div><b>Cc: </b> "ncl-talk"<<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><wbr>; </div><div><b>Subject: </b> Re: [ncl-talk] how to plot this triangle grids</div></div><div><div class="m_-6103437547860020612h5"><div><br></div><div dir="ltr"><div style="font-size:small">Dear Qi,</div><div style="font-size:small"><br></div><div style="font-size:small">We have an example similar to this. Please see:</div><div style="font-size:small"><br></div><div><a href="http://www.ncl.ucar.edu/Applications/table.shtml#ex6" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/table.shtml#ex6</a><br></div><div><br></div><div>This uses dummy data, but hopefully you can modify this to create four triangles per square.</div><div><br></div><div>If you can provide the data, then I can help you come up with a script.</div><div><br></div><div>--Mary</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 26, 2017 at 9:29 AM, LI Qi <span dir="ltr"><<a href="mailto:liqi123sh@qq.com" target="_blank">liqi123sh@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear NCL,</div><div><br></div><div>I'd like to ask how to plot the attached fig.</div><div>It's RMSE, the four quadrants in one grid representing four different reanalysis.</div><div>Is this plot attributed to triangle mesh or raster fill?</div><div>Thanks for any light shed on this.</div><div><br></div><div>Qi</div><div><br></div><div><br></div><div><img src="cid:3EE626EE@F9AE537D.D7C07859"></div><div><span>The “portrait” diagram of relative spatially averaged RMSEs in the 1981–2000 climatologies of temperature and precipitation indices simulated by the CMIP5 models with respect to the four reanalyses, ERA40 (left triangle), ERA-Interim (upper triangle), NCEP1 (right triangle), and NCEP2 (lower triangle). The RMSEs are spatially averaged over global land grid points. The top row indicates the mean relative RMSE across all indices for a particular model and the grey-shaded columns on the right side indicates the standardized median RMSE</span><sub>median,std</sub><span> for CMIP3 and CMIP5 (see text for details).</span></div><div><span><br></span></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>