[Thread Prev][Thread Next][Index]

Re: [EXTERNAL] Re: [ferret_users] plot only one color bar for all viewports



Dear Ansley and Saurabh,

Thank you for your suggestions. And Ansley, your no_data method is quite smart to make the extreme values appear on the sides. I guess I should make all the color levels the same so it's inner comparable among different models. 

Based on Ansley's method, I will find the max and min value among all models and make a variable that only contains these two values to make the correct min and max for all models to appear on the shakey. 

By the way, is there any command like the "ensemble" (https://ferret.pmel.noaa.gov/tutorials/PyFerret_exploring_ensembles.pdf) to add the same variable from different model solutions together? Looks like it only works for files (e.g. .nc) currently not for variables.

Any ferreters who want to control the numeric and character label can use something like "ppl axlabp,-1,0" for X and Y axes. -1=bottom/left of plot, 0=no label, +1=top/right of plot. Default=-1 (https://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/appendix-b-pplus-guide/COMMAND-DESCRIPTION#AppendixB_axlabp)

Stay healthy everyone,

Xiaoyu

On Tue, Feb 16, 2021 at 8:18 PM Ansley Manke <a.c.manke@xxxxxxxxx> wrote:
[Caution: Email from External Sender. Do not click or open links or attachments unless you know this sender.]
 

Hi,

Here is a message about this showing an example to define a set of viewports and draw a colorbar along the right hand side of the page. https://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2000/msg00226.html

I searched the archive using "colorbar viewports" in the search box. There may be other useful examples in the archive.

The idea can be generalized to other sets of viewports. The trick here is that the colorbar for a plot can be located anywhere on the page, even extending outside of the boundaries of the viewport being drawn.

I find that for PyFerret the size and location of the colorbar is different from that in Ferret - the message above goes back to a time when PyFerret didn't exist. So, the script would need to define the x-limits of the colorbar differently, perhaps,

! ppl shakey 1 1 .12 1 3 9 `($ppl$xlen)+0.8+.5` `($ppl$xlen)+0.8+.5+.5` 1.4 14.471


It's important to use the same set of color levels for all of the viewports, so that the colors in the common colorbar applies to all of panels.  Also, by the way, what you have done with the plot axis labels to remove the longitude and latitude labeling in the interior of the plot, makes a nice clean plot

Here's an example, applying the suggested set of viewports to data in one of the sample datasets (where I have not removed the excess longitude/latitude labeling)


! Description: sets viewports for 2 columns and 3 rows
! allow room for a big colorbar on the right
! this works well with the following shakey in the botr panel,
! and set win/asp=1.2 (else adjust the 2.25 in the final value)
! ppl shakey 1 1 .12 1 3 9 `($ppl$xlen)+0.8+.5` `($ppl$xlen)+0.8+.5+.5` 1.4 14.471

set win/asp=1.2
cancel mode logo

define view/xlimits=0,.51/ylimits=0,.42 botl
define view/xlimits=0,.51/ylimits=.29,.71 midl
define view/xlimits=0,.51/ylimits=.58,1.0 topl
define view/xlimits=.45,.96/ylimits=0,.42 botr
define view/xlimits=.45,.96/ylimits=.29,.71 midr
define view/xlimits=.45,.96/ylimits=.58,1.0 topr

! Plot January winds for several years

use monthly_navy_winds

set view topl; fill/L=1/nolab/nokey/lev=(-inf)(-12,12,1)(inf)/pal=centered_diff uwnd; go fland
set view topr; fill/L=12/nolab/nokey/lev=(-inf)(-12,12,1)(inf)/pal=centered_diff uwnd; go fland

...

set view botr; fill/L=72/nolab/nokey/lev=(-inf)(-12,12,1)(inf)/pal=centered_diff/set uwnd
ppl shakey 1 1 .12 1 3 9 `($ppl$xlen)+0.9+.5` `($ppl$xlen)+0.9+.5+.5` 1.4 14.471
ppl fill
go fland


If you want to draw a colorbar in a viewport, with only the colorbar but no other elements of the plot showing up, you can define a variable with no range in the region, and then use qualifiers such as /nolabel/noaxes work to draw a plot that is blank other than the colorbar.  For instance, plot a variable with values far out of the range of colors.  A shakey setting could be used here.  I have used key=horizontal to draw the colorbar across the top of the viewport.

yes? set view full
yes? let no_data = 0*missing(uwnd,0) + 1000   ! this variable is 1000 everywhere

yes? fill/L=1/lev=(-20,20,2)/key=horizontal no_data


    
On 2/16/2021 12:59 AM, Xiaoyu Bai wrote:
Dear ferreters,

I have 10 viewports of precipitation difference that all have similar but not the same levels (say levels=(-90,90,10) and levels=(-80,80,10)). It will be too noisy if I have 10 colorbars and I want the shading color to be the same for the same value (say red for -90 and blue for 90 no matter what my levels are). So I tried to plot only one shakey by setting view full after plotting all the subplots. Then I used ppl shakey and figured that Pyferret cannot find any shakeys because it already quit all the viewports. I am wondering if there is a way to create a shakey that works for all viewports (picking one viewport's shakey does not work for me because my levels are not all the same so the shakey will not be accurate, as attached).  

Thank you in advance and stay healthy,

--
Xiaoyu


--
Xiaoyu

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement