alpha settings in mplot3d

I haven't had a chance to look properly at the new mplot3d
improvements that Ben Root has been working on, but I wonder whether
it is easy now to set the axis properties so that the patches that
form the axes no longer have an alpha value of 0.5? I really want them
to be solid. The use case is that I often save images in a vector
format for editing within inkscape, do some fiddling, then re-export
as eps or pdf. If there are any semi-transparent objects, inkscape
will rasterize the whole image, so it becomes necessary to first go
through and manually set the alphas of all these patches to 1.0 before
saving.
A cursory look at the new code makes me hopeful that this is now
possible since the setting from _AXINFO has been moved to the Axis
constructor. Does that mean I'll be able to do something like
ax._axinfo['x']['color']=(0.3,0.3,0.3,1) with the new version?

Gary

Gary,

Glad to hear that you are kicking the tires. To make it clear, the _axinfo dictionary is in the Axis3D object (of which there are 3 in a Axes3D object). So, it would be something like:

ax.xaxis._axinfo[‘color’] = (0.3, 0.3, 0.3, 1)

At least, in theory. Part of the reason why I did not want to make this dictionary official is because the above would not actually work as expected. Although something similar for tick line colors might, for example. Because of the inconsistencies and because I did not want to paint myself into a corner, I have made this dictionary explicitly “users beware”.

However, there is hope for your problem! Use ax.xaxis.set_pane_color((0.3, 0.3, 0.3, 1)) instead!

Let me know if you encounter any other problems.
Ben Root

···

On Tue, Jul 19, 2011 at 9:25 PM, gary ruben <gruben@…636…> wrote:

I haven’t had a chance to look properly at the new mplot3d

improvements that Ben Root has been working on, but I wonder whether

it is easy now to set the axis properties so that the patches that

form the axes no longer have an alpha value of 0.5? I really want them

to be solid. The use case is that I often save images in a vector

format for editing within inkscape, do some fiddling, then re-export

as eps or pdf. If there are any semi-transparent objects, inkscape

will rasterize the whole image, so it becomes necessary to first go

through and manually set the alphas of all these patches to 1.0 before

saving.

A cursory look at the new code makes me hopeful that this is now

possible since the setting from _AXINFO has been moved to the Axis

constructor. Does that mean I’ll be able to do something like

ax._axinfo[‘x’][‘color’]=(0.3,0.3,0.3,1) with the new version?

Gary

Thanks Ben, that works nicely. Good work :slight_smile: (except that inkscape is
not nearly as good as matplotlib itself at optimising the resulting
vector-based pdf to keep the file size down - not mpl's fault though).
I just remembered, while trying this out, that there are two of every
object forming the axis parts - two of every patch, grid line, tick
line and label. It was this way before the latest changes also, but is
there a reason, or is it a bug? It doesn't impact visually though.

thanks for the great work on this,
Gary

···

On Wed, Jul 20, 2011 at 12:41 PM, Benjamin Root <ben.root@...1304...> wrote:

On Tue, Jul 19, 2011 at 9:25 PM, gary ruben <gruben@...636...> wrote:

I haven't had a chance to look properly at the new mplot3d
improvements that Ben Root has been working on, but I wonder whether
it is easy now to set the axis properties so that the patches that
form the axes no longer have an alpha value of 0.5? I really want them
to be solid. The use case is that I often save images in a vector
format for editing within inkscape, do some fiddling, then re-export
as eps or pdf. If there are any semi-transparent objects, inkscape
will rasterize the whole image, so it becomes necessary to first go
through and manually set the alphas of all these patches to 1.0 before
saving.
A cursory look at the new code makes me hopeful that this is now
possible since the setting from _AXINFO has been moved to the Axis
constructor. Does that mean I'll be able to do something like
ax._axinfo['x']['color']=(0.3,0.3,0.3,1) with the new version?

Gary

Gary,

Glad to hear that you are kicking the tires. To make it clear, the _axinfo
dictionary is in the Axis3D object (of which there are 3 in a Axes3D
object). So, it would be something like:

ax.xaxis._axinfo['color'] = (0.3, 0.3, 0.3, 1)

At least, in theory. Part of the reason why I did not want to make this
dictionary official is because the above would not actually work as
expected. Although something similar for tick line colors might, for
example. Because of the inconsistencies and because I did not want to paint
myself into a corner, I have made this dictionary explicitly "users beware".

However, there is hope for your problem! Use ax.xaxis.set_pane_color((0.3,
0.3, 0.3, 1)) instead!

Let me know if you encounter any other problems.
Ben Root

Glad that helped. I haven’t noticed the doubling issue, but I have my suspicions. It is likely an inadvertent side-effect of the current design. I will look out for that, but I am hopeful that this will resolve itself as I continue to refactor mplot3d.

If the problem hasn’t resolved itself before the next+1 release (i.e., whatever will come after v1.1.0), then ping me again for a reminder.

Cheers,
Ben Root

···

On Tue, Jul 19, 2011 at 10:22 PM, gary ruben <gruben@…636…> wrote:

Thanks Ben, that works nicely. Good work :slight_smile: (except that inkscape is

not nearly as good as matplotlib itself at optimising the resulting

vector-based pdf to keep the file size down - not mpl’s fault though).

I just remembered, while trying this out, that there are two of every

object forming the axis parts - two of every patch, grid line, tick

line and label. It was this way before the latest changes also, but is

there a reason, or is it a bug? It doesn’t impact visually though.

thanks for the great work on this,

Gary