Two sets of ticks on a single colorbar?

Greetings.

I am making some contour plots and in my field for this particular value, there are two widely used units. As such, it is very useful to have both units listed on the colorbar. To clarify: the colorbar’s normal ticks would be facing to the right and labeled with Unit Type 1, which was the units that the data were in when they were plotted. Unit Type 2 is simply a factor of X different than unit type two. It would be nice if I could add a second set of ticks to the color bar using a different locator and have them face left. Is this possible? Is there another way to display two values for each tick such that the colorbar shows both units?

Thanks.

-dw

Hi

I’d like to place a piece of text
that shows the start of some data so I want data coords in the x direction and
axis coords in the y – e.g. float with a particular x value and center in
the screen on the y.

Do I need to implement a new object or can
I mix transforms in this manner?

Many thx

David

disclaim.txt (2.02 KB)

I think the pretty-fying done in the Colorbar class will make this harder; at least, twiny on an existing colorbar doesn’t work (overwrites original ticks); having two colorbars works fine but wastes space; and adding a spine had surprising side-effects (changed the color range!).

I would guess that you want a custom Colorbar class, with a different offset for a second set of ticks.

note that in colorbar.py, there’s some code specific to CountourSets.

&C

···

On Nov 15, 2010, at 15 Nov, 8:22 AM, Daniel Welling wrote:

Greetings.

I am making some contour plots and in my field for this particular value, there are two widely used units. As such, it is very useful to have both units listed on the colorbar. To clarify: the colorbar’s normal ticks would be facing to the right and labeled with Unit Type 1, which was the units that the data were in when they were plotted. Unit Type 2 is simply a factor of X different than unit type two. It would be nice if I could add a second set of ticks to the color bar using a different locator and have them face left. Is this possible? Is there another way to display two values for each tick such that the colorbar shows both units?

Thanks.

-dw


Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Chloe Lewis

Ecosystem Sciences, Policy and Management, UC Berkeley
137 Mulford Hall
Berkeley, CA 94720-3114

http://nature.berkeley.edu/~chlewis

I believe “Blended” transformations is what you are looking for:

http://matplotlib.sourceforge.net/users/transforms_tutorial.html#blended-transformations

Haven’t tried it myself, but the description seems right.

Ben Root

···

On Mon, Nov 15, 2010 at 1:40 PM, <david.briant@…3351…7…> wrote:

Hi

I’d like to place a piece of text
that shows the start of some data so I want data coords in the x direction and
axis coords in the y – e.g. float with a particular x value and center in
the screen on the y.

Do I need to implement a new object or can
I mix transforms in this manner?

Many thx

David

You may use annotate.

annotate("Test", xy=(0.5, 0.3), xycoords=("axes fraction", "data"), ha="center")

This requires v1.0 of matplotlib.

http://matplotlib.sourceforge.net/users/annotations_guide.html#using-complex-coordinate-with-annotation

Regards,

-JJ