Ask Your Question
0

Washed out colors when saving plots to file

asked 2016-05-24 11:41:57 -0500

TumericTJ gravatar image

updated 2016-05-24 11:42:19 -0500

I try to use the save command with a view of a 3d plot, like

  mypic = implicit_plot3d(x^2 + y^2 + z^2 == distance, (x, -10, 10), (y, -10, 10), (z, -10, 10), opacity = 0.5) +  point3d(vector([0, 0, 0]), color = 'red', size = 10)
mypic.save('mypic.png', compress = false)

but the colors (in particular, the opacities) are washed out. There is no problem right-clicking to save as png from the notebook, but I want to save a bunch of pngs.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-05-24 14:50:02 -0500

Maybeso83 gravatar image

I think when the png is being constructed it doesn't handle the interaction between the opacity of the implicit plot and the point. Try adjusting your opacity. I also tested this:

distance = 56; x,y,z = var('x y z')
mypic = implicit_plot3d(x^2 + y^2 + z^2 == distance, (x, -10, 10), (y, -10, 10), (z, -10, 10), opacity = 0.5)
for k in range(-9, 10, 2): mypic = mypic + point3d(vector([5, k, 4]), color = 'red', size = 10)
mypic.save('mypic.png', compress = false)
mypic

The inline image shows a line of six red points from up-left to down-right ( \ ), with a center gap where four are completely blocked by the sphere. The saved png shows all ten points in a line from down-left to up-right ( / ), with the center four slightly hazy. So the png is also swapping x with y for the points (the axis labels are correct).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-05-24 11:41:57 -0500

Seen: 39 times

Last updated: May 24 '16