You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot get the new prop cycler to work with bar plots, it does not pick up the cycler properties at all.
I have minimally adapted the cycler demo to show this - see the ax1.bar calls. Running this gives two blue and one red bar plot, when it should give (in my expectation) one cyan, one magenta (from the cycle) and one red (manually set). The top axis' plot gets cycled correctly.
from cycler import cycler
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2 * np.pi)
offsets = np.linspace(0, 2*np.pi, 4, endpoint=False)
# Create array with shifted-sine curve along each column
yy = np.transpose([np.sin(x + phi) for phi in offsets])
plt.rc('lines', linewidth=4)
plt.rc('axes', prop_cycle=(cycler('color', ['r', 'g', 'b', 'y']) +
cycler('linestyle', ['-', '--', ':', '-.'])))
fig, (ax0, ax1) = plt.subplots(nrows=2)
ax0.plot(yy)
ax0.set_title('Set default color cycle to rgby')
ax1.set_prop_cycle(cycler('color', ['c', 'm', 'y', 'k']) +
cycler('lw', [1, 2, 3, 4]))
# ax1.plot(yy) # original
ax1.bar(x, yy[:,1]) # a simple bar plot from the available data
ax1.bar(x, yy[:,2]) # both these come out as blue
ax1.bar(x, yy[:,3], color='r') # this works, gives red bars, so "color" is recognized!
ax1.set_title('Set axes color cycle to cmyk')
# Tweak spacing between subplots to prevent labels from overlapping
plt.subplots_adjust(hspace=0.3)
plt.show()
This is on mpl 1.5.1. Is this pebkac, or does the cycler only work for some plots (if so, which ones)?
Also, are hatches supported by this, too (I mean, as soon as it works)? That's what I ultimately want to do.
For the most part, in v1.5.x, the cycler will only work where-ever color
cycling worked before. For the 2.0 release and beyond, we are working on
getting more plots to support using the cycler features. Now, if you find a
situation where color cycling works but other properties won't cycle, then
that is most likely a real bug (except for pie()...).
ax1.bar(x, yy[:,1]) # a simple bar plot from the available data
ax1.bar(x, yy[:,2]) # both these come out as blue
ax1.bar(x, yy[:,3], color='r') # this works, gives red bars, so "color" is recognized!
ax1.set_title('Set axes color cycle to cmyk')
Tweak spacing between subplots to prevent labels from overlapping
plt.subplots_adjust(hspace=0.3)
plt.show()
This is on mpl 1.5.1. Is this pebkac, or does the cycler only work for
some plots (if so, which ones)?
—
Reply to this email directly or view it on GitHub #5854.
really, how? It only talks about colors afaict, but not about property cycles (which can have properties other than color, e.g. hatch) for bar plots, if I haven't missed something?
Activity
WeatherGod commentedon Jan 14, 2016
For the most part, in v1.5.x, the cycler will only work where-ever color
cycling worked before. For the 2.0 release and beyond, we are working on
getting more plots to support using the cycler features. Now, if you find a
situation where color cycling works but other properties won't cycle, then
that is most likely a real bug (except for pie()...).
On Thu, Jan 14, 2016 at 11:10 AM, Christoph Buchner <
notifications@github.com> wrote:
mdboom commentedon Jan 14, 2016
#5674 addresses this issue (and others).
@WeatherGod: Why do you call out
pie. #5674 fixes pie as well?WeatherGod commentedon Jan 14, 2016
Right, I was talking about whatever has been released.
On Thu, Jan 14, 2016 at 12:28 PM, Michael Droettboom <
notifications@github.com> wrote:
bilderbuchi commentedon Jan 15, 2016
OK, so bar plots basically can't digest cycles if I understand correctly. Thanks, I missed that.
really, how? It only talks about colors afaict, but not about property cycles (which can have properties other than color, e.g. hatch) for bar plots, if I haven't missed something?
bilderbuchi commentedon Jan 15, 2016
@WeatherGod should I close this, then, or leave it open until next-major-release?
API: bar now color cycles
API: bar now color cycles
API: bar now color cycles
API: bar now color cycles
bilderbuchi commentedon May 24, 2016
awesome, thanks!