|
From: Sourish B. <sou...@gm...> - 2015-06-08 22:39:17
|
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
On 06/05/2015 03:57 PM, Joe Kington wrote:<br>
</div>
<blockquote
cite="mid:CAC...@ma..."
type="cite">
<p dir="ltr">Not to plug one of my own answers to much, but here's
a basic example. <a moz-do-not-send="true"
href="http://stackoverflow.com/questions/20144529/shifted-colorbar-matplotlib">http://stackoverflow.com/questions/20144529/shifted-colorbar-matplotlib</a></p>
<p dir="ltr">I've been meeting to submit a PR with a more full
featured version for a few years now, but haven't.</p>
</blockquote>
<br>
This is great, but it has a slightly bothersome side effect on the
colorbar ticks. In your original example, I changed the line 'data =
10 * (data - 0.8)' to 'data = 10 * (data - 0.85)', so that the
numbers are now in between -8.5 and +1.5. As a result, when the
colorbar is drawn, you get a tick at -8, as well as one at -9
(similarly at +1 and +2). Example attached. As in, the colorbar
method seems intent on adding those tick marks at -9 and +2. The
result is not aesthetically pleasing.<br>
<br>
In one of my real-data example, the minimum value of the data
happened to be -4.003, and as a result there was a tick label at -4
and an overlapping tick label at -5. Why does this happen only when
I specify 'norm' in imshow? How do I get matplotlib to not do that?<br>
<br>
Thanks,<br>
Sourish<br>
<br>
<blockquote
cite="mid:CAC...@ma..."
type="cite">
<div class="gmail_quote">On Jun 5, 2015 4:45 PM, "Sourish Basu"
<<a moz-do-not-send="true"
href="mailto:sou...@gm...">sou...@gm...</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>On 06/05/2015 01:20 PM, Eric Firing wrote: </div>
<blockquote type="cite">
<pre>Reminder: in matplotlib, color mapping is done with the combination of a
colormap and a norm. This allows one to design a norm to handle the
mapping, including any nonlinearity or difference between the handling
of positive and negative values. This is more general than customizing
a colormap; once you have a norm to suit your purpose, you can use it
with any colormap.
Maybe this is actually what you are already doing, but I wanted to point
it out here in case some readers are not familiar with this
colormap+norm strategy.</pre>
</blockquote>
<br>
Actually, I didn't use norms because I never quite figured
out how to use them or how to make my own. If there's a way
to create a norm with a custom mid-point, I'd love to
know/use that.<br>
<br>
-Sourish<br>
<br>
<blockquote type="cite">
<pre>
Eric
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
<a moz-do-not-send="true" href="mailto:Mat...@li..." target="_blank">Mat...@li...</a>
<a moz-do-not-send="true" href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a>
</pre>
</blockquote>
<br>
<br>
<div>-- <br>
<b>Q:</b> What if you strapped C4 to a boomerang? Could
this be an effective weapon, or would it be as stupid as
it sounds?<br>
<b>A:</b> Aerodynamics aside, I’m curious what tactical
advantage you’re expecting to gain by having the high
explosive fly back at you if it misses the target.<br>
</div>
</div>
<br>
------------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:Mat...@li...">Mat...@li...</a><br>
<a moz-do-not-send="true"
href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users"
target="_blank">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a><br>
<br>
</blockquote>
</div>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<b>Q:</b> What if you strapped C4 to a boomerang? Could this be an
effective weapon, or would it be as stupid as it sounds?<br>
<b>A:</b> Aerodynamics aside, I’m curious what tactical advantage
you’re expecting to gain by having the high explosive fly back at
you if it misses the target.<br>
</div>
</body>
</html>
|