fill_between issue

Hello all,

I’m having an issue with fill_between. It seems that setting the keyword linewidth=0 removes the entire patch, rather than the just the bounding lines. Example:

···

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)

y = np.sin(x)

plt.fill_between(x, y-0.1, y+0.1, linewidth=0) # Setting this !=0 works fine

plt.plot(x, y, ‘k’)

plt.show()

I’m using MPL version 1.4.2 on Python 2.7.8 (Gentoo Linux). This used to work fine before, but maybe there is a new way to do what…

Thanks

Ryan

Update.

This is a problem also in Anaconda Py3.4 with MPL 1.4.2, but it works without a problem on MPL 1.4.0.

Ryan

···

On Mon, Dec 8, 2014 at 12:15 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Hello all,

I’m having an issue with fill_between. It seems that setting the keyword linewidth=0 removes the entire patch, rather than the just the bounding lines. Example:

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)

y = np.sin(x)

plt.fill_between(x, y-0.1, y+0.1, linewidth=0) # Setting this !=0 works fine

plt.plot(x, y, ‘k’)

plt.show()

I’m using MPL version 1.4.2 on Python 2.7.8 (Gentoo Linux). This used to work fine before, but maybe there is a new way to do what…

Thanks

Ryan

Update 2.

I made a new Anaconda Python 2.7 environment and cycled through some different MPL versions. Everything works as I would expect in 1.4.0; however, moving to 1.4.1 is when the problem occurs. I see this same problem if I do the OO commands instead of pyplot.

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, np.pi*2, 1000)

y = np.sin(x)

ax = plt.axes()

fill = ax.fill_between(x, y-0.1, y+0.1)

fill.set_linewidth(0)

plt.show()

···

On Mon, Dec 8, 2014 at 3:38 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Update.

This is a problem also in Anaconda Py3.4 with MPL 1.4.2, but it works without a problem on MPL 1.4.0.

Ryan

On Mon, Dec 8, 2014 at 12:15 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Hello all,

I’m having an issue with fill_between. It seems that setting the keyword linewidth=0 removes the entire patch, rather than the just the bounding lines. Example:

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)

y = np.sin(x)

plt.fill_between(x, y-0.1, y+0.1, linewidth=0) # Setting this !=0 works fine

plt.plot(x, y, ‘k’)

plt.show()

I’m using MPL version 1.4.2 on Python 2.7.8 (Gentoo Linux). This used to work fine before, but maybe there is a new way to do what…

Thanks

Ryan

Final update.

I’ve done some more searching, and found a couple more things. It seems that this problem occurs with the backend set to “Agg” (`matplotlib.use(“agg”)), so it isn’t related to the interactive backends. In addition, the problem does not occur with a random Polygon object added to an axes; however, I do see the problem when the same polygon is added to the axes as a PolyCollection. See code below.

Ryan

···

On Mon, Dec 8, 2014 at 5:02 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Update 2.

I made a new Anaconda Python 2.7 environment and cycled through some different MPL versions. Everything works as I would expect in 1.4.0; however, moving to 1.4.1 is when the problem occurs. I see this same problem if I do the OO commands instead of pyplot.

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, np.pi*2, 1000)

y = np.sin(x)

ax = plt.axes()

fill = ax.fill_between(x, y-0.1, y+0.1)

fill.set_linewidth(0)

plt.show()

On Mon, Dec 8, 2014 at 3:38 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Update.

This is a problem also in Anaconda Py3.4 with MPL 1.4.2, but it works without a problem on MPL 1.4.0.

Ryan

On Mon, Dec 8, 2014 at 12:15 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Hello all,

I’m having an issue with fill_between. It seems that setting the keyword linewidth=0 removes the entire patch, rather than the just the bounding lines. Example:

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)

y = np.sin(x)

plt.fill_between(x, y-0.1, y+0.1, linewidth=0) # Setting this !=0 works fine

plt.plot(x, y, ‘k’)

plt.show()

I’m using MPL version 1.4.2 on Python 2.7.8 (Gentoo Linux). This used to work fine before, but maybe there is a new way to do what…

Thanks

Ryan

Interesting. Just to double-check, when you say that it only happens for the “agg” backend, are you saying that backends like “tkagg” are unaffected? I think at this point there is enough information here to file a bug report.

Ben Root

···

On Mon, Dec 8, 2014 at 6:14 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Final update.

I’ve done some more searching, and found a couple more things. It seems that this problem occurs with the backend set to “Agg” (`matplotlib.use(“agg”)), so it isn’t related to the interactive backends. In addition, the problem does not occur with a random Polygon object added to an axes; however, I do see the problem when the same polygon is added to the axes as a PolyCollection. See code below.

Ryan

import numpy as np

import matplotlib

matplotlib.use(“Agg”)

import matplotlib.pyplot as plt

from matplotlib.collections import PolyCollection

x = np.linspace(0, np.pi*2, 1000)

y = np.sin(x)

ax = plt.axes()

data =np.array([(0,0), (1,0), (1,1), (0,1)])

These three lines work fine.

poly = plt.Polygon(data)

poly.set_linewidth(0)

ax.add_patch(poly)

Comment out the three lines above

Uncomment next three lines, does not work.

#col = PolyCollection([data])

#col.set_linewidth(0.0)

#ax.add_collection(col)

plt.axis([-2, 2, -2, 2])

plt.savefig(‘junk’)


Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server

from Actuate! Instantly Supercharge Your Business Reports and Dashboards

with Interactivity, Sharing, Native Excel Exports, App Integration & more

Get technology previously reserved for billion-dollar corporations, FREE

http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On Mon, Dec 8, 2014 at 5:02 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Update 2.

I made a new Anaconda Python 2.7 environment and cycled through some different MPL versions. Everything works as I would expect in 1.4.0; however, moving to 1.4.1 is when the problem occurs. I see this same problem if I do the OO commands instead of pyplot.

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, np.pi*2, 1000)

y = np.sin(x)

ax = plt.axes()

fill = ax.fill_between(x, y-0.1, y+0.1)

fill.set_linewidth(0)

plt.show()

On Mon, Dec 8, 2014 at 3:38 PM, Ryan Nelson <rnelsonchem@…120…287…> wrote:

Update.

This is a problem also in Anaconda Py3.4 with MPL 1.4.2, but it works without a problem on MPL 1.4.0.

Ryan

On Mon, Dec 8, 2014 at 12:15 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Hello all,

I’m having an issue with fill_between. It seems that setting the keyword linewidth=0 removes the entire patch, rather than the just the bounding lines. Example:

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)

y = np.sin(x)

plt.fill_between(x, y-0.1, y+0.1, linewidth=0) # Setting this !=0 works fine

plt.plot(x, y, ‘k’)

plt.show()

I’m using MPL version 1.4.2 on Python 2.7.8 (Gentoo Linux). This used to work fine before, but maybe there is a new way to do what…

Thanks

Ryan

Ah… That was not clear. I just retried my first example (with show->savefig) for all of the backends that I have available: Qt4Agg, TkAgg, PS, PDF, pgf, Cairo, GTK3Cairo, GTK3Agg. All of the *Agg backends show the same problem: the other backends work as expected. I will file a bug report now.

Ryan

···

On Tue, Dec 9, 2014 at 9:50 AM, Benjamin Root <ben.root@…1304…> wrote:

Interesting. Just to double-check, when you say that it only happens for the “agg” backend, are you saying that backends like “tkagg” are unaffected? I think at this point there is enough information here to file a bug report.

Ben Root

On Mon, Dec 8, 2014 at 6:14 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Final update.

I’ve done some more searching, and found a couple more things. It seems that this problem occurs with the backend set to “Agg” (`matplotlib.use(“agg”)), so it isn’t related to the interactive backends. In addition, the problem does not occur with a random Polygon object added to an axes; however, I do see the problem when the same polygon is added to the axes as a PolyCollection. See code below.

Ryan

import numpy as np

import matplotlib

matplotlib.use(“Agg”)

import matplotlib.pyplot as plt

from matplotlib.collections import PolyCollection

x = np.linspace(0, np.pi*2, 1000)

y = np.sin(x)

ax = plt.axes()

data =np.array([(0,0), (1,0), (1,1), (0,1)])

These three lines work fine.

poly = plt.Polygon(data)

poly.set_linewidth(0)

ax.add_patch(poly)

Comment out the three lines above

Uncomment next three lines, does not work.

#col = PolyCollection([data])

#col.set_linewidth(0.0)

#ax.add_collection(col)

plt.axis([-2, 2, -2, 2])

plt.savefig(‘junk’)


Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server

from Actuate! Instantly Supercharge Your Business Reports and Dashboards

with Interactivity, Sharing, Native Excel Exports, App Integration & more

Get technology previously reserved for billion-dollar corporations, FREE

http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On Mon, Dec 8, 2014 at 5:02 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Update 2.

I made a new Anaconda Python 2.7 environment and cycled through some different MPL versions. Everything works as I would expect in 1.4.0; however, moving to 1.4.1 is when the problem occurs. I see this same problem if I do the OO commands instead of pyplot.

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, np.pi*2, 1000)

y = np.sin(x)

ax = plt.axes()

fill = ax.fill_between(x, y-0.1, y+0.1)

fill.set_linewidth(0)

plt.show()

On Mon, Dec 8, 2014 at 3:38 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Update.

This is a problem also in Anaconda Py3.4 with MPL 1.4.2, but it works without a problem on MPL 1.4.0.

Ryan

On Mon, Dec 8, 2014 at 12:15 PM, Ryan Nelson <rnelsonchem@…287…> wrote:

Hello all,

I’m having an issue with fill_between. It seems that setting the keyword linewidth=0 removes the entire patch, rather than the just the bounding lines. Example:

import numpy as np

import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)

y = np.sin(x)

plt.fill_between(x, y-0.1, y+0.1, linewidth=0) # Setting this !=0 works fine

plt.plot(x, y, ‘k’)

plt.show()

I’m using MPL version 1.4.2 on Python 2.7.8 (Gentoo Linux). This used to work fine before, but maybe there is a new way to do what…

Thanks

Ryan