SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(16)
2
(8)
3
(4)
4
5
6
(3)
7
(11)
8
(16)
9
(1)
10
(2)
11
(2)
12
(6)
13
(2)
14
(4)
15
(5)
16
(10)
17
(5)
18
19
20
21
(3)
22
23
(12)
24
(7)
25
(1)
26
27
(3)
28
(4)
29
(5)
30
(2)


Showing 8 results of 8

From: John L. <kd...@gm...> - 2015年04月02日 17:45:42
Jody and Ben,
That does the business! I had hunted for awhile, but didn’t find that solution. Thank you for your help!
Cheers,
John Leeman
> On Apr 2, 2015, at 1:02 PM, Benjamin Root <ben...@ou...> wrote:
> 
> ::Looks again::
> 
> Ok, I see what you did here:
> 
> cmap = plt.get_cmap('rainbow_r’)
> start=0.2
> stop = 1.
> colors = cmap(np.linspace(start, stop, cmap.N))
> # Create a new colormap from those colors
> color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
> 
> I missed this part the first time through, noticing only the change to the vmin. Yeah, I think that would work just fine. Sorry for the confusion.
> 
> Cheers!
> Ben Root
> 
> 
> On Thu, Apr 2, 2015 at 12:56 PM, Jody Klymak <jk...@uv... <mailto:jk...@uv...>> wrote:
> 
> 
>> On 2 Apr 2015, at 9:50 AM, Benjamin Root <ben...@ou... <mailto:ben...@ou...>> wrote:
>> 
>> No, that's not what he is asking for. John wants the norm to go from -1 to 4, but he wants the colorbar to display only the 0 to 4 portion. Your approach (setting vmin=0) would change the normalization and change the colors.
> 
> Hmm, well his values go from 0 to 4, and he wants his colorbar to go from 0 to 4, but just over the last 4/5ths of the colormap. I think I gave him what he wants. But I guess he can decide!
> 
> Cheers, Jody
> 
>> The axes limits do not appear to be scaled by the values. They are set to (0, 1). So, the kludgy way would seem to be to set the xlimits to be (0.2, 1) (taking out a fifth of the colorbar, but the frame is still there...
>> 
>> Ben Root
>> 
>> On Thu, Apr 2, 2015 at 12:32 PM, Jody Klymak <jk...@uv... <mailto:jk...@uv...>> wrote:
>> Hi John,
>> 
>> I got this off stack exchange, apologies to the original contributor...
>> 
>> Cheers, Jody
>> 
>> 
>> import numpy as np
>> import matplotlib.pyplot as plt
>> from matplotlib.colors import LinearSegmentedColormap
>> 
>> x = np.arange(100)
>> y = np.random.rand(100)
>> z = 4 * np.random.rand(100)
>> 
>> cmap = plt.get_cmap('rainbow_r’)
>> start=0.2
>> stop = 1.
>> colors = cmap(np.linspace(start, stop, cmap.N))
>> # Create a new colormap from those colors
>> color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
>> 
>> fig = plt.figure(figsize=(12,9))
>> ax1 = plt.subplot(111)
>> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4)
>> 
>> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
>> cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False)
>> cb.set_label('Z-Colors', fontsize=14)
>> 
>> # I tried this after talking with Ben Root, but it
>> # results in some odd behavior
>> # cb.ax.set_xlim(0,4)
>> 
>> plt.show()
>> 
>> 
>> 
>>> On 2 Apr 2015, at 5:47 AM, John Leeman <kd...@gm... <mailto:kd...@gm...>> wrote:
>>> 
>>> Hi all,
>>> 
>>> I’m plotting some scatter points colored by a third variable, but want to use a limited subset of a colormap. In the example below, the color axis data ranges from 0-4, but I want to not use the red portion of the bar. Doing the first part is just accomplished by setting the vmin/vmax. But when I plot a color bar I don’t want to show the colors and values for anything below zero. Other than just white-boxing that part of the bar I’m not sure how to do it. I tried a suggestion of setting the limit properties of the bar axis attribute, but that results in the bar getting shrunk and shifted (a very weird behavior). Any ideas?
>>> 
>>> Thank you,
>>> 
>>> John Leeman
>>> 
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> 
>>> x = np.arange(100)
>>> y = np.random.rand(100)
>>> z = 4 * np.random.rand(100)
>>> 
>>> color_map = plt.get_cmap('rainbow_r')
>>> 
>>> fig = plt.figure(figsize=(12,9))
>>> ax1 = plt.subplot(111)
>>> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
>>> 
>>> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
>>> cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False)
>>> cb.set_label('Z-Colors’, fontsize=14)
>>> 
>>> # I tried this after talking with Ben Root, but it
>>> # results in some odd behavior
>>> # cb.ax.set_xlim(0,4)
>>> 
>>> plt.show()
>>> <Color_Bar.png>
>>> ------------------------------------------------------------------------------
>>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>>> things parallel software development, from weekly thought leadership blogs to
>>> news, videos, case studies, tutorials and more. Take a look and join the 
>>> conversation now. http://goparallel.sourceforge.net/_______________________________________________ <http://goparallel.sourceforge.net/_______________________________________________>
>>> Matplotlib-users mailing list
>>> Mat...@li... <mailto:Mat...@li...>
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>> 
>> --
>> Jody Klymak 
>> http://web.uvic.ca/~jklymak/ <http://web.uvic.ca/~jklymak/>
>> 
>> 
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>> things parallel software development, from weekly thought leadership blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/ <http://goparallel.sourceforge.net/>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li... <mailto:Mat...@li...>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>> 
>> 
> 
> 
> --
> Jody Klymak 
> http://web.uvic.ca/~jklymak/ <http://web.uvic.ca/~jklymak/>
> 
> 
> 
> 
> 
> 
From: Benjamin R. <ben...@ou...> - 2015年04月02日 17:03:12
::Looks again::
Ok, I see what you did here:
cmap = plt.get_cmap('rainbow_r’)
start=0.2
stop = 1.
colors = cmap(np.linspace(start, stop, cmap.N))
# Create a new colormap from those colors
color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
I missed this part the first time through, noticing only the change to the
vmin. Yeah, I think that would work just fine. Sorry for the confusion.
Cheers!
Ben Root
On Thu, Apr 2, 2015 at 12:56 PM, Jody Klymak <jk...@uv...> wrote:
>
>
> On 2 Apr 2015, at 9:50 AM, Benjamin Root <ben...@ou...> wrote:
>
> No, that's not what he is asking for. John wants the norm to go from -1 to
> 4, but he wants the colorbar to display only the 0 to 4 portion. Your
> approach (setting vmin=0) would change the normalization and change the
> colors.
>
>
> Hmm, well his values go from 0 to 4, and he wants his colorbar to go from
> 0 to 4, but just over the last 4/5ths of the colormap. I think I gave him
> what he wants. But I guess he can decide!
>
> Cheers, Jody
>
> The axes limits do not appear to be scaled by the values. They are set to
> (0, 1). So, the kludgy way would seem to be to set the xlimits to be (0.2,
> 1) (taking out a fifth of the colorbar, but the frame is still there...
>
> Ben Root
>
> On Thu, Apr 2, 2015 at 12:32 PM, Jody Klymak <jk...@uv...> wrote:
>
>> Hi John,
>>
>> I got this off stack exchange, apologies to the original contributor...
>>
>> Cheers, Jody
>>
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>> from matplotlib.colors import LinearSegmentedColormap
>>
>> x = np.arange(100)
>> y = np.random.rand(100)
>> z = 4 * np.random.rand(100)
>>
>> cmap = plt.get_cmap('rainbow_r’)
>> start=0.2
>> stop = 1.
>> colors = cmap(np.linspace(start, stop, cmap.N))
>> # Create a new colormap from those colors
>> color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
>>
>> fig = plt.figure(figsize=(12,9))
>> ax1 = plt.subplot(111)
>> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4)
>>
>> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
>> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
>> drawedges=False)
>> cb.set_label('Z-Colors', fontsize=14)
>>
>> # I tried this after talking with Ben Root, but it
>> # results in some odd behavior
>> # cb.ax.set_xlim(0,4)
>>
>> plt.show()
>>
>>
>>
>> On 2 Apr 2015, at 5:47 AM, John Leeman <kd...@gm...> wrote:
>>
>> Hi all,
>>
>> I’m plotting some scatter points colored by a third variable, but want to
>> use a limited subset of a colormap. In the example below, the color axis
>> data ranges from 0-4, but I want to not use the red portion of the bar.
>> Doing the first part is just accomplished by setting the vmin/vmax. But
>> when I plot a color bar I don’t want to show the colors and values for
>> anything below zero. Other than just white-boxing that part of the bar I’m
>> not sure how to do it. I tried a suggestion of setting the limit properties
>> of the bar axis attribute, but that results in the bar getting shrunk and
>> shifted (a very weird behavior). Any ideas?
>>
>> Thank you,
>>
>> John Leeman
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> x = np.arange(100)
>> y = np.random.rand(100)
>> z = 4 * np.random.rand(100)
>>
>> color_map = plt.get_cmap('rainbow_r')
>>
>> fig = plt.figure(figsize=(12,9))
>> ax1 = plt.subplot(111)
>> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
>>
>> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
>> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
>> drawedges=False)
>> cb.set_label('Z-Colors’, fontsize=14)
>>
>> # I tried this after talking with Ben Root, but it
>> # results in some odd behavior
>> # cb.ax.set_xlim(0,4)
>>
>> plt.show()
>> <Color_Bar.png>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> things parallel software development, from weekly thought leadership
>> blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now.
>> http://goparallel.sourceforge.net/_______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> --
>> Jody Klymak
>> http://web.uvic.ca/~jklymak/
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> things parallel software development, from weekly thought leadership
>> blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
From: Jody K. <jk...@uv...> - 2015年04月02日 16:56:27
> On 2 Apr 2015, at 9:50 AM, Benjamin Root <ben...@ou...> wrote:
> 
> No, that's not what he is asking for. John wants the norm to go from -1 to 4, but he wants the colorbar to display only the 0 to 4 portion. Your approach (setting vmin=0) would change the normalization and change the colors.
Hmm, well his values go from 0 to 4, and he wants his colorbar to go from 0 to 4, but just over the last 4/5ths of the colormap. I think I gave him what he wants. But I guess he can decide!
Cheers, Jody
> The axes limits do not appear to be scaled by the values. They are set to (0, 1). So, the kludgy way would seem to be to set the xlimits to be (0.2, 1) (taking out a fifth of the colorbar, but the frame is still there...
> 
> Ben Root
> 
> On Thu, Apr 2, 2015 at 12:32 PM, Jody Klymak <jk...@uv... <mailto:jk...@uv...>> wrote:
> Hi John,
> 
> I got this off stack exchange, apologies to the original contributor...
> 
> Cheers, Jody
> 
> 
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.colors import LinearSegmentedColormap
> 
> x = np.arange(100)
> y = np.random.rand(100)
> z = 4 * np.random.rand(100)
> 
> cmap = plt.get_cmap('rainbow_r’)
> start=0.2
> stop = 1.
> colors = cmap(np.linspace(start, stop, cmap.N))
> # Create a new colormap from those colors
> color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
> 
> fig = plt.figure(figsize=(12,9))
> ax1 = plt.subplot(111)
> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4)
> 
> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
> cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False)
> cb.set_label('Z-Colors', fontsize=14)
> 
> # I tried this after talking with Ben Root, but it
> # results in some odd behavior
> # cb.ax.set_xlim(0,4)
> 
> plt.show()
> 
> 
> 
>> On 2 Apr 2015, at 5:47 AM, John Leeman <kd...@gm... <mailto:kd...@gm...>> wrote:
>> 
>> Hi all,
>> 
>> I’m plotting some scatter points colored by a third variable, but want to use a limited subset of a colormap. In the example below, the color axis data ranges from 0-4, but I want to not use the red portion of the bar. Doing the first part is just accomplished by setting the vmin/vmax. But when I plot a color bar I don’t want to show the colors and values for anything below zero. Other than just white-boxing that part of the bar I’m not sure how to do it. I tried a suggestion of setting the limit properties of the bar axis attribute, but that results in the bar getting shrunk and shifted (a very weird behavior). Any ideas?
>> 
>> Thank you,
>> 
>> John Leeman
>> 
>> import numpy as np
>> import matplotlib.pyplot as plt
>> 
>> x = np.arange(100)
>> y = np.random.rand(100)
>> z = 4 * np.random.rand(100)
>> 
>> color_map = plt.get_cmap('rainbow_r')
>> 
>> fig = plt.figure(figsize=(12,9))
>> ax1 = plt.subplot(111)
>> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
>> 
>> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
>> cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False)
>> cb.set_label('Z-Colors’, fontsize=14)
>> 
>> # I tried this after talking with Ben Root, but it
>> # results in some odd behavior
>> # cb.ax.set_xlim(0,4)
>> 
>> plt.show()
>> <Color_Bar.png>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for all
>> things parallel software development, from weekly thought leadership blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the 
>> conversation now. http://goparallel.sourceforge.net/_______________________________________________ <http://goparallel.sourceforge.net/_______________________________________________>
>> Matplotlib-users mailing list
>> Mat...@li... <mailto:Mat...@li...>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
> 
> --
> Jody Klymak 
> http://web.uvic.ca/~jklymak/ <http://web.uvic.ca/~jklymak/>
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/ <http://goparallel.sourceforge.net/>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li... <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
> 
> 
--
Jody Klymak 
http://web.uvic.ca/~jklymak/
From: Benjamin R. <ben...@ou...> - 2015年04月02日 16:51:21
No, that's not what he is asking for. John wants the norm to go from -1 to
4, but he wants the colorbar to display only the 0 to 4 portion. Your
approach (setting vmin=0) would change the normalization and change the
colors.
The axes limits do not appear to be scaled by the values. They are set to
(0, 1). So, the kludgy way would seem to be to set the xlimits to be (0.2,
1) (taking out a fifth of the colorbar, but the frame is still there...
Ben Root
On Thu, Apr 2, 2015 at 12:32 PM, Jody Klymak <jk...@uv...> wrote:
> Hi John,
>
> I got this off stack exchange, apologies to the original contributor...
>
> Cheers, Jody
>
>
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.colors import LinearSegmentedColormap
>
> x = np.arange(100)
> y = np.random.rand(100)
> z = 4 * np.random.rand(100)
>
> cmap = plt.get_cmap('rainbow_r’)
> start=0.2
> stop = 1.
> colors = cmap(np.linspace(start, stop, cmap.N))
> # Create a new colormap from those colors
> color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
>
> fig = plt.figure(figsize=(12,9))
> ax1 = plt.subplot(111)
> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4)
>
> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
> drawedges=False)
> cb.set_label('Z-Colors', fontsize=14)
>
> # I tried this after talking with Ben Root, but it
> # results in some odd behavior
> # cb.ax.set_xlim(0,4)
>
> plt.show()
>
>
>
> On 2 Apr 2015, at 5:47 AM, John Leeman <kd...@gm...> wrote:
>
> Hi all,
>
> I’m plotting some scatter points colored by a third variable, but want to
> use a limited subset of a colormap. In the example below, the color axis
> data ranges from 0-4, but I want to not use the red portion of the bar.
> Doing the first part is just accomplished by setting the vmin/vmax. But
> when I plot a color bar I don’t want to show the colors and values for
> anything below zero. Other than just white-boxing that part of the bar I’m
> not sure how to do it. I tried a suggestion of setting the limit properties
> of the bar axis attribute, but that results in the bar getting shrunk and
> shifted (a very weird behavior). Any ideas?
>
> Thank you,
>
> John Leeman
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> x = np.arange(100)
> y = np.random.rand(100)
> z = 4 * np.random.rand(100)
>
> color_map = plt.get_cmap('rainbow_r')
>
> fig = plt.figure(figsize=(12,9))
> ax1 = plt.subplot(111)
> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
>
> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
> cb = fig.colorbar(sc, cax=position, orientation='horizontal',
> drawedges=False)
> cb.set_label('Z-Colors’, fontsize=14)
>
> # I tried this after talking with Ben Root, but it
> # results in some odd behavior
> # cb.ax.set_xlim(0,4)
>
> plt.show()
> <Color_Bar.png>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now.
> http://goparallel.sourceforge.net/_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> --
> Jody Klymak
> http://web.uvic.ca/~jklymak/
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jody K. <jk...@uv...> - 2015年04月02日 16:32:51
Hi John,
I got this off stack exchange, apologies to the original contributor...
Cheers, Jody
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
x = np.arange(100)
y = np.random.rand(100)
z = 4 * np.random.rand(100)
cmap = plt.get_cmap('rainbow_r’)
start=0.2
stop = 1.
colors = cmap(np.linspace(start, stop, cmap.N))
# Create a new colormap from those colors
color_map = LinearSegmentedColormap.from_list('Upper Half', colors)
fig = plt.figure(figsize=(12,9))
ax1 = plt.subplot(111)
sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=0, vmax=4)
position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False)
cb.set_label('Z-Colors', fontsize=14)
# I tried this after talking with Ben Root, but it
# results in some odd behavior
# cb.ax.set_xlim(0,4)
plt.show()
> On 2 Apr 2015, at 5:47 AM, John Leeman <kd...@gm...> wrote:
> 
> Hi all,
> 
> I’m plotting some scatter points colored by a third variable, but want to use a limited subset of a colormap. In the example below, the color axis data ranges from 0-4, but I want to not use the red portion of the bar. Doing the first part is just accomplished by setting the vmin/vmax. But when I plot a color bar I don’t want to show the colors and values for anything below zero. Other than just white-boxing that part of the bar I’m not sure how to do it. I tried a suggestion of setting the limit properties of the bar axis attribute, but that results in the bar getting shrunk and shifted (a very weird behavior). Any ideas?
> 
> Thank you,
> 
> John Leeman
> 
> import numpy as np
> import matplotlib.pyplot as plt
> 
> x = np.arange(100)
> y = np.random.rand(100)
> z = 4 * np.random.rand(100)
> 
> color_map = plt.get_cmap('rainbow_r')
> 
> fig = plt.figure(figsize=(12,9))
> ax1 = plt.subplot(111)
> sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
> 
> position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
> cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False)
> cb.set_label('Z-Colors’, fontsize=14)
> 
> # I tried this after talking with Ben Root, but it
> # results in some odd behavior
> # cb.ax.set_xlim(0,4)
> 
> plt.show()
> <Color_Bar.png>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Jody Klymak 
http://web.uvic.ca/~jklymak/
From: John L. <kd...@gm...> - 2015年04月02日 12:47:42
Hi all,
I’m plotting some scatter points colored by a third variable, but want to use a limited subset of a colormap. In the example below, the color axis data ranges from 0-4, but I want to not use the red portion of the bar. Doing the first part is just accomplished by setting the vmin/vmax. But when I plot a color bar I don’t want to show the colors and values for anything below zero. Other than just white-boxing that part of the bar I’m not sure how to do it. I tried a suggestion of setting the limit properties of the bar axis attribute, but that results in the bar getting shrunk and shifted (a very weird behavior). Any ideas?
Thank you,
John Leeman
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(100)
y = np.random.rand(100)
z = 4 * np.random.rand(100)
color_map = plt.get_cmap('rainbow_r')
fig = plt.figure(figsize=(12,9))
ax1 = plt.subplot(111)
sc = ax1.scatter(x, y, c=z, s=50, cmap=color_map, vmin=-1, vmax=4)
position=fig.add_axes([0.37, 0.16, 0.5, 0.02])
cb = fig.colorbar(sc, cax=position, orientation='horizontal', drawedges=False)
cb.set_label('Z-Colors’, fontsize=14)
# I tried this after talking with Ben Root, but it
# results in some odd behavior
# cb.ax.set_xlim(0,4)
plt.show()
From: Jens N. <jen...@gm...> - 2015年04月02日 10:34:46
I have opened a Pull request (
https://github.com/matplotlib/matplotlib/pull/4305) to improve the error
message and avoid the comparison between a string and version number.
ons. 1. apr. 2015 kl. 18.05 skrev Christian Ambros <am...@ym...>:
> Hi,
>
> I installed the libfreetype6-dev package and than re-started the upgrade
> process with sudo pip3 install matplotlib --upgrade, which took a while but
> finally was successful.
> It seems to be all right now.
>
> Thanks for the hint with freetype. That helped a lot.
> cheers,
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
> On Wednesday, April 1, 2015 4:52 PM, Benjamin Root <ben...@ou...>
> wrote:
>
>
> Yeah, that mirrors what others have stated. The common thread seems to be
> that all of these users were comfortable with doing "sudo pip install
> <somepkg>" (myself included). I was in a rush when I originally encountered
> issues back in the summer on my 12.04 machine, so I just switched to
> miniconda and didn't figure out what was wrong on my system.
>
>
>
> On Wed, Apr 1, 2015 at 12:27 PM, Christian Ambros <am...@ym...>
> wrote:
>
> Hi,
>
> as you can see: 14.3.1 which is the latest, because before I started
> upgrading, I read about possible issues here and upgraded the setuptools as
> conclusion.
>
> Python 3.4.0 (default, Apr 11 2014, 13:05:11)
> [GCC 4.8.2] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import setuptools
> >>> print(setuptools.__version__)
> 14.3.1
> >>> exit()
>
> cheers,
> Christian
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
>
>
>
> On Wednesday, April 1, 2015 1:25 PM, Jens Nielsen <
> jen...@gm...> wrote:
>
>
> I think we have seen this issue before and it seems to be caused by an out
> of date version of setuptools. I tried reproducing it on fresh ubuntu 14.04
> machine but was not able to reproduce the issue. Do you know which version
> of setuptools you are using?
>
> Jens
>
> ons. 1. apr. 2015 kl. 14.19 skrev Thomas Caswell <tca...@gm...>:
>
> Make sure you have `freetype-dev` installed at the system level.
>
> Tom
>
> On Wed, Apr 1, 2015 at 8:02 AM Christian Ambros <am...@ym...> wrote:
>
> Hi,
>
> I'm facing the same trouble with installing matplotlib 1.4.3 and 1.5.dev1.
> running
>
> python3 setup.py build
>
> in the unarchived directory gives this:
> ============================================================
> ================
> Edit setup.cfg to change the build options
>
> BUILDING MATPLOTLIB
> matplotlib: yes [1.5.dev1]
> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11) [GCC
> 4.8.2]]
> platform: yes [linux]
>
> REQUIRED DEPENDENCIES AND EXTENSIONS
> numpy: yes [version 1.9.2]
> six: yes [using six version 1.5.2]
> dateutil: yes [using dateutil version 2.0]
> pytz: yes [using pytz version 2012c]
> tornado: yes [using tornado version 3.1.1]
> pyparsing: yes [using pyparsing version 2.0.1]
> libagg: yes [Requires patches that have not been merged
> upstream. Using local copy.]
> Traceback (most recent call last):
> File "setup.py", line 153, in <module>
> result = package.check()
> File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 900,
> in check
> min_version='2.3', version=version)
> File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 446,
> in _check_for_pkg_config
> if (not is_min_version(version, min_version)):
> File "/home/ambrosc/Downloads/matplotlib-master/setupext.py", line 173,
> in is_min_version
> return found_version >= expected_version
> File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
> c = self._cmp(other)
> File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
> if self.version < other.version:
> TypeError: unorderable types: str() < int()
>
> I'm running Linux Mint 17 "Quina" which is based on Ubuntu's trusty
> packges.
>
> pip3 is up to date. Running
> print(setuptools.__file__)
>
> gives: /usr/local/lib/python3.4/dist-packages/setuptools/__init__.py
> which is as expected.
>
> Using pip3 install matplotlib --upgrade #even to 1.4.3
> get's me this:
>
>
> Collecting matplotlib from https://pypi.python.org/
> packages/source/m/matplotlib/matplotlib-1.4.3.tar.gz#md5=
> 86af2e3e3c61849ac7576a6f5ca44267
> Downloading matplotlib-1.4.3.tar.gz (50.4MB)
> 100% |################################| 50.4MB 8.0kB/s
> Traceback (most recent call last):
> File "<string>", line 20, in <module>
> File "/tmp/pip-build-sezmzam8/matplotlib/setup.py", line 155, in
> <module>
> result = package.check()
> File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 961, in
> check
> min_version='2.3', version=version)
> File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 445, in
> _check_for_pkg_config
> if (not is_min_version(version, min_version)):
> File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 173, in
> is_min_version
> return found_version >= expected_version
> File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
> c = self._cmp(other)
> File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
> if self.version < other.version:
> TypeError: unorderable types: str() < int()
> ============================================================
> ================
> Edit setup.cfg to change the build options
> BUILDING MATPLOTLIB
> matplotlib: yes [1.4.3]
> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)
> [GCC
> 4.8.2]]
> platform: yes [linux]
> REQUIRED DEPENDENCIES AND EXTENSIONS
> numpy: yes [version 1.9.2]
> six: yes [using six version 1.5.2]
> dateutil: yes [using dateutil version 2.0]
> pytz: yes [using pytz version 2012c]
> tornado: yes [using tornado version 3.1.1]
> pyparsing: yes [using pyparsing version 2.0.1]
> pycxx: yes [Official versions of PyCXX are not
> compatible
> with matplotlib on Python 3.x, since they lack
> support for the buffer object. Using local
> copy]
> libagg: yes [Requires patches that have not been merged
> upstream. Using local copy.]
> Complete output from command python setup.py egg_info:
> Traceback (most recent call last):
>
> File "<string>", line 20, in <module>
>
> File "/tmp/pip-build-sezmzam8/matplotlib/setup.py", line 155, in
> <module>
>
> result = package.check()
>
> File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 961, in
> check
>
> min_version='2.3', version=version)
>
> File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 445, in
> _check_for_pkg_config
>
> if (not is_min_version(version, min_version)):
>
> File "/tmp/pip-build-sezmzam8/matplotlib/setupext.py", line 173, in
> is_min_version
>
> return found_version >= expected_version
>
> File "/usr/lib/python3.4/distutils/version.py", line 76, in __ge__
>
> c = self._cmp(other)
>
> File "/usr/lib/python3.4/distutils/version.py", line 343, in _cmp
>
> if self.version < other.version:
>
> TypeError: unorderable types: str() < int()
>
> ============================================================
> ================
>
> Edit setup.cfg to change the build options
>
>
>
> BUILDING MATPLOTLIB
>
> matplotlib: yes [1.4.3]
>
> python: yes [3.4.0 (default, Apr 11 2014, 13:05:11)
> [GCC
>
> 4.8.2]]
>
> platform: yes [linux]
>
>
>
> REQUIRED DEPENDENCIES AND EXTENSIONS
>
> numpy: yes [version 1.9.2]
>
> six: yes [using six version 1.5.2]
>
> dateutil: yes [using dateutil version 2.0]
>
> pytz: yes [using pytz version 2012c]
>
> tornado: yes [using tornado version 3.1.1]
>
> pyparsing: yes [using pyparsing version 2.0.1]
>
> pycxx: yes [Official versions of PyCXX are not
> compatible
>
> with matplotlib on Python 3.x, since they lack
>
> support for the buffer object. Using local
> copy]
>
> libagg: yes [Requires patches that have not been merged
>
> upstream. Using local copy.]
>
> ----------------------------------------
> Command "python setup.py egg_info" failed with error code 1 in
> /tmp/pip-build-sezmzam8/matplotlib
> Which leads to the same error!
>
> running python2.7 setup.py egg_info doesn't fail but since I have to use
> 3.4.x ant pyqt5.4.x there is no way to use something else than matplotlib
> 1.4.3/1.5dev1 because auf the qt5agg backend.
>
> Any hints on how to get along?
>
> Christian
>
> --
> "A little learning never caused anyone's head to explode!"
>
>
> "Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"
> ------------------------------------------------------------
> ------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> ------------------------------------------------------------
> ------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------
> ------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------
> ------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Fernando P. <fpe...@gm...> - 2015年04月02日 05:33:29
On Wed, Apr 1, 2015 at 10:27 AM, Prahas David Nafissian <
pra...@gm...> wrote:
>
> For a little right brain diversion, here's what I created
> using matplotlib:
>
> https://www.youtube.com/watch?v=gWkFnPHbHok&feature=youtu.be
>
> Enjoy!
>
Wow! Thank you so much for sharing this, it's beautiful, and a really great
combination of math and art.
John would have loved it... :)
Fernando Perez (@fperez_org; http://fperez.org)
fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
fernando.perez-at-berkeley: contact me here for any direct mail

Showing 8 results of 8

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /