Skip to content

Colorbar Add kw arguement to colorbar to reenable edges around faces - #1301

Closed
jenshnielsen wants to merge 1 commit into
matplotlib:masterfrom
jenshnielsen:colorbar_kwarg
Closed

jenshnielsen wants to merge 1 commit into
matplotlib:masterfrom
jenshnielsen:colorbar_kwarg

Conversation

@jenshnielsen

Copy link
Copy Markdown
Member

This is an alternative way to resolve problems with white lines in colorbars. It is not enabled by default due to problems with alpha< 1 and colorbar extensions. See #1178 and #1188

This is certainly not the ultimate solution but since it seems difficult to get the viewers fixed this is the simplest workaround that I could come up with.

the colorbar. Resolve problems with white lines in colorbars.
Not enabled by default.  See matplotlib#1178 and matplotlib#1188
@dmcdougall

Copy link
Copy Markdown
Member

Are we sure it's a problem with the viewer and not with the renderer?

@jenshnielsen

Copy link
Copy Markdown
Member Author

As I understand the problem. The issue is that when you render 2 meshes next to each other, with same start and end coordinates they will at some resolutions be rendered with a gab. According to the poppler bug this has to due with the interpolation to the screen resolution which is also reflected in the fact that it looks different at different resolutions. However I have no idea about if the pdf or svg specs has any thing to say about this behavior.

@efiring

efiring commented Sep 23, 2012

Copy link
Copy Markdown
Member

I'm not enthusiastic about cluttering the API with a kwarg to produce incorrect files because some viewers are buggy. An alternative is for the user to explicitly set the edgecolors:

imshow(rand(10,10))
cbar = colorbar()
cbar.solids.set_edgecolor("face")
draw()

@dmcdougall

Copy link
Copy Markdown
Member

I am inclined to agree with @efiring.

@jenshnielsen If you have witnessed this problem with every backend, then this is unlikely to be a bug in matplotlib but an upstream problem. Even if it is a problem with a matplotlib renderer, this change, as @efiring points out, technically produces incorrect figures.

@jenshnielsen

Copy link
Copy Markdown
Member Author

@efiring I didn't realize that it is that that simple to add the edges. I think that it should be sufficient to add that as a workaround to the documentation to for colorbar. Just as simple as the kwarg. You should however realize that this is not just a few viewers. Tested on ubuntu 12.04. evince, okular (libpoppler), pdf.js (more buggy and beta so we can forget about this one), Firefox (svg), Chrome (svg), gnome image viewer (svg) and Inkscape (both pdf import and svg) shows the issue. xpdf is broken in ubuntu as always so i don't know about that one.

@dmcdougall Yes and that is what I have written both here and in #1178 and #1188 that it is not a mpl bug.
I know that this is technically not correct that is why it is not on by default as written in the original pull request, but the edges were actually removed by accident when #901 was merged to allow different edge colors NOT to fix a bug.

In addition matlab fx. renders the colorbar as an image avoiding the problem. Thus the average user is likely to conclude that this is a bug in matplotlib.

If you are ok with adding some info to the colorbar docs suggesting the workaround by @efiring. I will open a new pull request for this (and close this one).

@efiring

efiring commented Sep 23, 2012

Copy link
Copy Markdown
Member

@jenshnielsen Yes, adding a note to the docs is a good idea.

@dmcdougall

Copy link
Copy Markdown
Member

Closing: Documentation updated. See #1315.

@dmcdougall dmcdougall closed this Sep 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants