<div dir="ltr"><div>This is a similar problem to that of plotting two imshow()'s. You should be able to pass vmin/vmax arguments to scatter, I believe.</div><div><br></div><div>Ben<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 28, 2019 at 11:57 AM Neal Becker <<a href="mailto:ndbecker2@gmail.com">ndbecker2@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'm trying to make 2 scatter plots where the colors of each point <br>
corresponds to the value of a 1d array.<br>
<br>
I want to do this so that the colors used in the 2 plots are comparable.  <br>
That is, in plot 1 a violet dot means the same value as on plot 2.<br>
<br>
I tried the following code.  Here values2 is clearly different than values1.  <br>
But it appears that the plots are colored with the same colors.  And the <br>
colorbar scales are different.  What I want is to have the colorbar scales <br>
be the same, and the colors on the plot are different.<br>
<br>
So for example, if point #1 on plot 1 has a value of 0.4, and point #1 on <br>
plot 2 has a value of 0.5, the colors used to represent given values on the <br>
2 plots are the same.  I believe that without colorbar, just using scatter <br>
with specific c=value, I do get this result.  But adding colorbar I think <br>
changes all the colors.<br>
<br>
Any suggestions?<br>
<br>
<br>
import numpy as np<br>
pts = np.random.uniform (0, 1, 100) + 1j*np.random.uniform(0, 1, 100)<br>
values1 = np.random.uniform(0, 1, 100)<br>
#values2 = np.random.uniform(0.2, 1, 100)<br>
values2 = values1 * 0.8 + 0.2<br>
<br>
import matplotlib.pyplot as plt<br>
for value in (values1, values2):<br>
    fig, ax = plt.subplots(subplot_kw={'aspect': 'equal'})<br>
    cmap=plt.get_cmap('plasma')<br>
    blah = ax.scatter (pts.real, pts.imag, c=value, s=10)<br>
    blah.set_array (value)<br>
    fig.colorbar (blah)<br>
plt.show()<br>
<br>
<br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
</blockquote></div>